Skip to content

Commit

Permalink
ci: Update release.yml
Browse files Browse the repository at this point in the history
Continues to fail when every time the main branch is built because the testpypi upload doesn't have different filenames. Rather than try to create unique filenames (and potentially create a huge pypi entry) this adds a guard to stop pypi and testpypi unless it is a tag.


Signed-off-by: David Hart <[email protected]>
  • Loading branch information
dbhart authored Oct 2, 2024
1 parent 10922d3 commit d872ad1
Showing 1 changed file with 33 additions and 29 deletions.
62 changes: 33 additions & 29 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,40 @@ jobs:
name: cibw-sdist
path: dist/*.tar.gz

publish-to-testpypi:
name: Publish Python 🐍 distribution πŸ“¦ to TestPyPI
needs: [build_wheels, make_sdist]
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository == 'sandialabs/sansmic' }} # only publish to PyPI on tag pushes

environment:
name: testpypi
url: https://test.pypi.org/p/sansmic

permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
pattern: cibw-*
path: dist
merge-multiple: true
- name: Publish distribution πŸ“¦ to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
print-hash: true
verbose: true
attestations: true
repository-url: https://test.pypi.org/legacy/

publish-to-pypi:
name: >-
Publish Python 🐍 distribution πŸ“¦ to PyPI
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository == 'sandialabs/sansmic' }} # only publish to PyPI on tag pushes
needs: [build_wheels, make_sdist]
needs: [publish-to-testpypi]
environment:
name: release
url: https://pypi.org/p/sansmic
Expand All @@ -83,6 +112,9 @@ jobs:
merge-multiple: true
- name: Publish distribution πŸ“¦ to PyPI
uses: pypa/gh-action-pypi-publish@897895f1e160c830e369f9779632ebc134688e1b # release/v1
with:
attestations: true
print-hash: true

github-release:
name: >-
Expand Down Expand Up @@ -127,31 +159,3 @@ jobs:
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
publish-to-testpypi:
name: Publish Python 🐍 distribution πŸ“¦ to TestPyPI
needs: [build_wheels, make_sdist]
runs-on: ubuntu-latest
if: ${{ github.repository == 'sandialabs/sansmic' }}

environment:
name: testpypi
url: https://test.pypi.org/p/sansmic

permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
pattern: cibw-*
path: dist
merge-multiple: true
- name: Publish distribution πŸ“¦ to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
print-hash: true
verbose: true
repository-url: https://test.pypi.org/legacy/

0 comments on commit d872ad1

Please sign in to comment.