Skip to content

Commit

Permalink
Merge pull request #162 from Urban-Analytics-Technology-Platform/fix-…
Browse files Browse the repository at this point in the history
…deploy-to-pypi

Update CD build environment to publish to PyPI / TestPyPI
  • Loading branch information
andrewphilipsmith authored Dec 10, 2024
2 parents 76ff16b + b3628bd commit 8c8d1c1
Showing 1 changed file with 17 additions and 21 deletions.
38 changes: 17 additions & 21 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,28 @@ jobs:
with:
path: dist/*.tar.gz

build_wheels:
name: Wheel on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
upload_release:
needs: [make_sdist]
environment: release
permissions:
id-token: write
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'

steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
fetch-depth: 0

- uses: pypa/cibuildwheel@v2.22
name: artifact
path: dist

- name: Upload wheels
uses: actions/upload-artifact@v4
with:
path: wheelhouse/*.whl
- uses: pypa/gh-action-pypi-publish@release/v1

upload_all:
needs: [build_wheels, make_sdist]
environment: release
upload_test:
needs: [make_sdist]
environment: testpypi
permissions:
id-token: write
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'

steps:
- uses: actions/download-artifact@v4
Expand All @@ -65,6 +60,7 @@ jobs:

- uses: pypa/gh-action-pypi-publish@release/v1
with:
# Remember to tell (test-)pypi about this repo before publishing
# Remove this line to publish to PyPI
repository-url: https://test.pypi.org/legacy/
# Only skip existing distributions on testpypi (not on pypi).
# See https://github.com/pypa/gh-action-pypi-publish?tab=readme-ov-file#tolerating-release-package-file-duplicates
skip-existing: true

0 comments on commit 8c8d1c1

Please sign in to comment.