Skip to content

Commit

Permalink
ci: update release.yml for trusted publishing to PyPI (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
wpbonelli committed Sep 12, 2023
1 parent 8168826 commit 2095ced
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ jobs:
permissions:
contents: write
pull-requests: write
id-token: write # mandatory for trusted publishing
environment: # requires a 'release' environment in repo settings
name: release
url: https://pypi.org/p/modflow-devtools
steps:

- name: Checkout main branch
Expand All @@ -188,12 +192,14 @@ jobs:
- name: Check package
run: twine check --strict dist/*

- name: Publish package
if: ${{ env.TWINE_USERNAME != '' }}
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: twine upload dist/*
- name: Upload package
uses: actions/upload-artifact@v3
with:
name: dist
path: dist

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

reset:
name: Draft reset PR
Expand Down

0 comments on commit 2095ced

Please sign in to comment.