Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,56 +42,68 @@ jobs:
with:
name: python-package-distributions
path: dist/
release_check:
name: Check whether to do a release
needs:
- build_test
runs-on: ubuntu-latest
outputs:
should_release: ${{ steps.whether_to_release.outputs.should_release}}
permissions:
id-token: write # IMPORTANT: this permission is required to write to github envs
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check whether to release
uses: MathieuMoalic/action-python-package-new-version@v1.0.5
- name: Assign whether to release to output
id: whether_to_release
run: echo "should_release=${{ env.PUBLISHING }}" >> "$GITHUB_OUTPUT"
release:
name: Release NMSpy wheels and source build to PyPI
# Only run this job if the commit was tagged.
if: startsWith(github.ref, 'refs/tags')
if: ${{ startsWith(github.ref, 'refs/tags') && needs.release_check.outputs.should_release == 'true' }}
needs:
- build_test
- release_check
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/NMSpy
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Check whether to release
uses: MathieuMoalic/action-python-package-new-version@v1.0.5
- name: Download files for release
if: env.PUBLISHING == 'true'
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish package distributions to PyPI
if: env.PUBLISHING == 'true'
uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true

test-release:
name: Release NMSpy wheels and source build to test-PyPI
# Only run this job if we merge into master. Addition check is added later.
if: github.ref == 'refs/heads/master'
if: ${{ github.ref == 'refs/heads/master' && needs.release_check.outputs.should_release == 'true' }}
needs:
- build_test
- release_check
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/NMSpy
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Check whether to release
uses: MathieuMoalic/action-python-package-new-version@v1.0.5
- name: Download files for release
if: env.PUBLISHING == 'true'
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish package distributions to PyPI
if: env.PUBLISHING == 'true'
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
Expand Down