Skip to content

Commit 6ef30f1

Browse files
misi9170RHammond2
andauthored
Use PyPI Trusted Publishing workflow (#1184)
* Update workflow for PyPI trusted publishing * Apply suggestions from code review Bump to latest action versions and remove PyPI secret Co-authored-by: Rob Hammond <13874373+RHammond2@users.noreply.github.com> * Formatting --------- Co-authored-by: Rob Hammond <13874373+RHammond2@users.noreply.github.com>
1 parent 4199b5e commit 6ef30f1

1 file changed

Lines changed: 18 additions & 16 deletions

File tree

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# This workflows will upload a Python Package using Twine when a release is created
2+
# Published via GitHub Actions as a PyPI Trusted Publisher.
23
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
4+
# and: https://docs.pypi.org/trusted-publishers/
35

46
name: Upload Python Package
57

@@ -9,22 +11,22 @@ on:
911

1012
jobs:
1113
deploy:
14+
environment: release-pypi
1215
if: github.repository_owner == 'NatLabRockies'
1316
runs-on: ubuntu-latest
1417
steps:
15-
- uses: actions/checkout@v3
16-
- name: Set up Python
17-
uses: actions/setup-python@v4
18-
with:
19-
python-version: '3.x'
20-
- name: Install dependencies
21-
run: |
22-
python -m pip install --upgrade pip
23-
pip install build twine
24-
- name: Build and publish
25-
env:
26-
TWINE_USERNAME: __token__
27-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
28-
run: |
29-
python -m build
30-
twine upload dist/*
18+
- uses: actions/checkout@v6
19+
- name: Set up Python
20+
uses: actions/setup-python@v6
21+
with:
22+
python-version: '3.x'
23+
- name: Install dependencies and build package
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install build twine
27+
python -m build
28+
twine check --strict dist/*
29+
- name: Publish package to PyPI
30+
uses: pypa/gh-action-pypi-publish@release/v1
31+
with:
32+
verbose: True

0 commit comments

Comments
 (0)