Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: split build and upload jobs in ci-cd GHA workflow #44

Merged
merged 13 commits into from
Mar 28, 2024
Merged
35 changes: 28 additions & 7 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,13 @@ jobs:
run: |
echo "GitHub requires the step do something, so we're just going to echo something here."

release:
build_release:
needs:
- check_if_should_release

runs-on: ubuntu-latest
environment: pypi
environment: build_release
concurrency: release
permissions:
id-token: write
contents: write

steps:
- uses: actions/checkout@v4
Expand All @@ -127,12 +124,36 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/

release:
needs:
- build_release

runs-on: ubuntu-latest
environment: pypi
concurrency: release
permissions:
id-token: write
contents: write

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: steps.release.outputs.released == 'true'
if: steps.build_release.outputs.released == 'true'

- name: Publish package distributions to GitHub Releases
uses: python-semantic-release/upload-to-gh-release@main
if: steps.release.outputs.released == 'true'
if: steps.build_release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}