Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to PyPI Trusted Publishing, and remove twine #212

Merged
merged 10 commits into from
Jun 6, 2024
23 changes: 14 additions & 9 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflows will upload a Python Package using Twine when a release is created
# This workflows will upload a Python Package using Trusted Publishing when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: tests
Expand Down Expand Up @@ -84,10 +84,16 @@ jobs:

deploy:
# this will run when you have tagged a commit, starting with "v*"
# and requires that you have put your twine API key in your
# github secrets (see readme for details)
# and requires that you have setup PyPI Trusted Publishing
# (see https://docs.pypi.org/trusted-publishers/adding-a-publisher/)
needs: [ test ]
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
environment:
name: pypi
url: https://pypi.org/project/napari-animation
if: contains(github.ref, 'tags')
steps:
- uses: actions/checkout@v4
Expand All @@ -98,12 +104,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools setuptools_scm wheel twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }}
pip install -U setuptools setuptools_scm wheel
- name: Build python package
GenevieveBuckley marked this conversation as resolved.
Show resolved Hide resolved
run: |
git tag
python setup.py sdist bdist_wheel
twine upload dist/*
GenevieveBuckley marked this conversation as resolved.
Show resolved Hide resolved
GenevieveBuckley marked this conversation as resolved.
Show resolved Hide resolved
- name: Publish package distributions to PyPI
# This action uploads everything from the dist/ folder to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Loading