Skip to content

Commit

Permalink
Merge pull request #192 from phobson/unified-publish-workflow
Browse files Browse the repository at this point in the history
unify the publishing workflows
  • Loading branch information
phobson authored Oct 8, 2024
2 parents 4db7a97 + 9531285 commit 15ec6cb
Showing 1 changed file with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions .github/workflows/python-publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Publish Python 🐍 distribution 📦 to PyPI
on:
workflow_dispatch:
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI

on: push

jobs:
build:
Expand All @@ -10,10 +10,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Install pypa/build
run: >-
python3 -m
Expand All @@ -36,14 +35,14 @@ jobs:
- build
runs-on: ubuntu-latest
environment:
name: release
name: pypi
url: https://pypi.org/p/wqio # Replace <package-name> with your PyPI project name
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v4.1.7
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
Expand All @@ -64,7 +63,7 @@ jobs:

steps:
- name: Download all the dists
uses: actions/download-artifact@v4.1.7
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
Expand Down Expand Up @@ -92,3 +91,27 @@ jobs:
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
publish-to-testpypi:
name: Publish Python 🐍 distribution 📦 to TestPyPI
needs:
- build
runs-on: ubuntu-latest

environment:
name: testpypi
url: https://test.pypi.org/p/wqio

permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

0 comments on commit 15ec6cb

Please sign in to comment.