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
25 changes: 15 additions & 10 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 @@ -95,10 +95,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 @@ -109,12 +115,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 }}
python -m pip install build setuptools setuptools_scm
- name: Build python package
run: |
git tag
python setup.py sdist bdist_wheel
twine upload dist/*
python -m build
- name: Publish package distributions to PyPI
# This action uploads everything from the dist/ folder to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[build-system]
requires = [
"build",
"setuptools >= 42",
"wheel",
"setuptools_scm[toml]>=3.4"
]
build-backend = "setuptools.build_meta"


[tool.black]
target-version = ['py38', 'py39', 'py310', 'py311']
target-version = ['py39', 'py310', 'py311', 'py312']
line-length = 79
exclude = '''
(
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ classifiers =
Framework :: napari
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Operating System :: OS Independent
License :: OSI Approved :: BSD License

Expand Down
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ python =
3.10: py310
3.11: py311
3.12: py312

[gh-actions:env]
PLATFORM =
ubuntu-latest: linux
Expand Down Expand Up @@ -40,12 +40,14 @@ commands = pytest -v --color=yes --cov=napari_animation --cov-report=xml
deps =
napari[pyqt5,testing]
lxml_html_clean # should only be needed till napari 0.5.0
# . # napari-animation install from source

# PySide2 unavailable on Mac apple silicon arm64, and for python >=3.11
[testenv:py{39,310}-{linux,macosintel,windows}-pyside]
deps =
napari[pyside2,testing]
lxml_html_clean # should only be needed till napari 0.5.0
# . # napari-animation install from source

[testenv:ruff]
skip_install = True
Expand Down
Loading