Skip to content

Commit

Permalink
trust publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
ifduyue committed Jul 6, 2024
1 parent 3a9b5ba commit 61a1075
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,16 @@ jobs:
path: dist/*.tar.gz


upload_pypi:
name: Upload to (Test) PyPI
upload_test_pypi:
name: Upload to Test PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-20.04
if: github.event_name == 'push' && github.repository == 'ifduyue/xxtea'
if: github.event_name == 'push' && github.repository == 'ifduyue/xxtea' && !startsWith(github.ref, 'refs/tags/v')
environment:
name: test-pypi
url: https://test.pypi.org/project/xxtea/
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
Expand All @@ -93,15 +98,26 @@ jobs:
- name: Upload to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TEST_TOKEN }}
skip-existing: true
repository-url: https://test.pypi.org/legacy/

upload_pypi:
name: Upload to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-20.04
if: github.event_name == 'push' && github.repository == 'ifduyue/xxtea' && startsWith(github.ref, 'refs/tags/v')
environment:
name: pypi
url: https://pypi.org/project/xxtea/
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
path: dist
merge-multiple: true

- name: Upload to PyPI
if: startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
skip-existing: true

0 comments on commit 61a1075

Please sign in to comment.