Skip to content

Commit

Permalink
Safer publishing mechanism, refs #8
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Aug 20, 2024
1 parent bcebc92 commit e5f252c
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions {{cookiecutter.hyphenated}}/.github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,9 @@ jobs:
- name: Run tests
run: |
python -m pytest
deploy:
build:
runs-on: ubuntu-latest
needs: [test]
environment: release
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
Expand All @@ -47,6 +44,25 @@ jobs:
- name: Build
run: |
python -m build
- name: Publish
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-packages
path: dist/
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [build]
environment: release
permissions:
id-token: write
steps:
- name: Download distribution packages
uses: actions/download-artifact@v4
with:
name: python-packages
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
{% endraw %}

1 comment on commit e5f252c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.