Skip to content

Commit

Permalink
Publish packages to PyPi with trusted publishers
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
  • Loading branch information
s0undt3ch committed Jul 28, 2023
1 parent d91af44 commit 9a5c288
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,33 @@ on:
types: [created]

jobs:
Publish:
publish:
name: Publish Release
environment: release
runs-on: ubuntu-latest
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install Nox
run: |
python -m pip install nox
- name: Build a binary wheel and a source tarball
run: |
nox -e build
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
print_hash: true
print-hash: true
skip-existing: true
verify-metadata: true
11 changes: 7 additions & 4 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,9 @@ jobs:

Build:
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
needs:
- Docs
- PyLint
Expand Down Expand Up @@ -463,7 +466,7 @@ jobs:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/
print_hash: true
repository-url: https://test.pypi.org/legacy/
print-hash: true
skip-existing: true
verify-metadata: true
1 change: 1 addition & 0 deletions changelog/151.trivial.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Publish packages to PyPi with trusted publishers

0 comments on commit 9a5c288

Please sign in to comment.