-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
π§ chore(ci): restructure GitHub Actions workflow for PyPI publication
- split single workflow into logical job stages - add separate jobs for build, PyPI, TestPyPI, and post-release tasks - improve clarity and modularity of release process - align step names with descriptive emojis for better readability
- Loading branch information
Showing
1 changed file
with
56 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,8 @@ permissions: | |
id-token: write | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
build: | ||
name: Build distribution π¦ | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -38,9 +38,11 @@ jobs: | |
with: | ||
version-command: | | ||
cat pyproject.toml | grep "version = " | head -n 1 | awk -F'"' '{print $2}' | ||
- name: Install Dependencies | ||
run: | | ||
uv sync | ||
- name: Bump version for developmental release | ||
if: "! steps.check-version.outputs.tag" | ||
run: | | ||
|
@@ -56,18 +58,62 @@ jobs: | |
name: python-package-distributions | ||
path: dist/ | ||
|
||
- name: Publish to PyPI | ||
if: steps.check-version.outputs.tag | ||
publish-to-pypi: | ||
name: Publish Python π distribution π¦ to PyPI | ||
if: steps.check-version.outputs.tag | ||
needs: | ||
- build | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/yadt | ||
|
||
permissions: | ||
id-token: write | ||
|
||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
|
||
- name: Publish distribution π¦ to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
||
publish-to-testpypi: | ||
name: Publish Python π distribution π¦ to TestPyPI | ||
if: "! steps.check-version.outputs.tag" | ||
needs: | ||
- build | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: testpypi | ||
url: https://test.pypi.org/p/yadt | ||
|
||
permissions: | ||
id-token: write | ||
|
||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v4 | ||
with: | ||
repository-url: https://pypi.org/legacy/ | ||
name: python-package-distributions | ||
path: dist/ | ||
|
||
- name: Publish to TestPyPI | ||
if: "! steps.check-version.outputs.tag" | ||
- name: Publish distribution π¦ to TestPyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
|
||
post-release: | ||
name: Post Release Tasks | ||
needs: | ||
- build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Sign the dists with Sigstore | ||
uses: sigstore/[email protected] | ||
with: | ||
|
@@ -99,5 +145,7 @@ jobs: | |
GITHUB_TOKEN: ${{ github.token }} | ||
run: >- | ||
gh release upload | ||
"${{ steps.check-version.outputs.tag }}" dist/** | ||
"${{ steps.check-version.outputs.tag }}" | ||
./dist/*.tar.gz.sig | ||
./dist/*.whl.sig | ||
--repo "$GITHUB_REPOSITORY" |