@@ -6,23 +6,18 @@ name: Release Python Package
66on :
77 push :
88 tags :
9- # Trigger on SemVer tags. Commitizen configured in pyproject.toml (Area 12)
10- # uses PEP 440 which is SemVer compatible.
119 - " v[0-9]+.[0-9]+.[0-9]+"
1210 - " v[0-9]+.[0-9]+.[0-9]+-*" # Include pre-release tags
1311
14- # Allow workflow to be run manually from the Actions tab for a specific tag
1512 workflow_dispatch :
1613 inputs :
1714 tag :
1815 description : ' Git tag to build and release (e.g., v1.2.3). Must already exist.'
19- required : true # User must provide a tag when manually dispatching
16+ required : true
2017
2118jobs :
22- # Job 1: Build the package and publish to TestPyPI
2319 build_and_testpypi :
2420 name : Build & Publish to TestPyPI
25- # Run on a consistent, standard build environment
2621 runs-on : ubuntu-latest
2722
2823 steps :
@@ -40,42 +35,31 @@ jobs:
4035 python-version-file : .python-version
4136
4237 - name : Upload built package artifacts
43- # Upload packages so the publish job can access them.
4438 uses : actions/upload-artifact@v4
4539 with :
46- name : distribution-packages # Name the artifact
47- path : dist/ # Path to the built sdist/wheel files
48- retention-days : 7 # Keep built artifacts for 7 days
40+ name : distribution-packages
41+ path : dist/
42+ retention-days : 7
4943
5044 - name : Download built package artifacts
5145 uses : actions/download-artifact@v4
5246 with :
53- name : distribution-packages-{{"{{ github.event.inputs.tag }}"}}
47+ name : distribution-packages-{{"$ {{ github.event.inputs.tag }}"}}
5448 path : dist/
5549
56- # --- Publish to TestPyPI Step ---
57- # This step runs within the same job after build.
5850 - name : Publish to TestPyPI
59- # Execute the Task Automation publish session for TestPyPI.
60- # This calls uv publish dist/* with TestPyPI credentials/config (Topic 10).
6151 env :
62- # TestPyPI credentials stored as secrets in GitHub Settings -> Secrets
63- TWINE_USERNAME : __token__ # Standard username when using API tokens
64- TWINE_PASSWORD : {{"${{ secrets.TESTPYPI_API_TOKEN }}"}} # Use GitHub Encrypted Secret
65- # Optional: If uv publish requires different config for repository URL, pass TWINE_REPOSITORY or similar
66- run : uvx nox -s publish-package -- --repository testpypi # Call the publish-package session, passing repository arg
67-
68- # --- Get Changelog Content for Release Notes ---
69- # Use a standard action to extract changelog content.
70- # This action requires a standard CHANGELOG.md format.
52+ TWINE_USERNAME : __token__
53+ TWINE_PASSWORD : {{"${{ secrets.TESTPYPI_API_TOKEN }}"}}
54+ run : uvx nox -s publish-package -- --repository testpypi
55+
7156 - name : Get Release Notes from Changelog
7257 id : changelog
73- uses : simple-changelog/action@v3 # Action to parse CHANGELOG.md
58+ uses : simple-changelog/action@v3
7459 with :
75- path : CHANGELOG.md # Path to your CHANGELOG.md
76- tag : {{"${{ github.event_name == 'push' && github.ref_name || github.event.inputs.tag }}"}} # Pass the tag name
60+ path : CHANGELOG.md
61+ tag : {{"${{ github.event_name == 'push' && github.ref_name || github.event.inputs.tag }}"}}
7762
78- # Define outputs from this job that other jobs (like create_github_release) can use.
7963 outputs :
8064 changelog_body :
8165 description : " Release notes body extracted from CHANGELOG.md"
0 commit comments