Skip to content

Commit

Permalink
Issue #1287: Implementation of secure publishing. ...
Browse files Browse the repository at this point in the history
  • Loading branch information
jpl-jengelke committed Sep 16, 2024
1 parent c1ca968 commit e13536b
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ name: Upload Python Package

on:
release:
types: [published]
types: [ published ]

jobs:
deploy:

build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -28,10 +29,25 @@ jobs:
run: |
python3 -m build --wheel
python3 setup.py sdist --format=zip
- name: Publish package
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine check dist/*
twine upload --verbose dist/*.whl dist/*.zip
- name: Store package
uses: actions/upload-artifact@v4
with:
name: python-package-distribution
path: dist/

release:
runs-on: ubuntu-latest
environment:
name: release
permissions:
id-token: write # mandatory for trusted publishing
steps:
- name: Retrieve package
uses: actions/download-artifact@v4
with:
name: python-package-distribution
path: dist/
- name: Publish package (PyPi)
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://pypi.org/p/exotic # for testing sub https://test.pypi.org/legacy/

0 comments on commit e13536b

Please sign in to comment.