|
53 | 53 | TWINE_PASSWORD: ${{ secrets.TESTPYPI_API_TOKEN }} |
54 | 54 | run: uvx nox -s publish-package -- --repository testpypi |
55 | 55 |
|
56 | | - - name: Get Release Notes from Changelog |
57 | | - id: changelog |
58 | | - uses: simple-changelog/action@v3 |
59 | | - with: |
60 | | - path: CHANGELOG.md |
61 | | - tag: ${{ github.event_name == 'push' && github.ref_name || github.event.inputs.tag }} |
62 | | - |
63 | | - outputs: |
64 | | - changelog_body: |
65 | | - description: "Release notes body extracted from CHANGELOG.md" |
66 | | - value: ${{ steps.changelog.outputs.changes }} # Output the extracted changelog body |
67 | | - |
68 | 56 | publish_pypi: |
69 | 57 | name: Publish to Production PyPI |
70 | 58 | runs-on: ubuntu-latest |
|
91 | 79 | TWINE_USERNAME: __token__ |
92 | 80 | TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} |
93 | 81 | run: uvx nox -s publish-python |
94 | | - |
95 | | - create_github_release: |
96 | | - name: Create GitHub Release |
97 | | - runs-on: ubuntu-latest |
98 | | - needs: build_and_testpypi |
99 | | - |
100 | | - if: "github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')" |
101 | | - |
102 | | - steps: |
103 | | - - name: Download package artifacts # Get built artifacts for release assets |
104 | | - uses: actions/download-artifact@v4 |
105 | | - with: |
106 | | - name: distribution-packages |
107 | | - |
108 | | - - name: Get tag name |
109 | | - id: get_tag |
110 | | - run: echo "tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT |
111 | | - |
112 | | - - name: Generate Release Notes |
113 | | - run: | |
114 | | - if [ -z "${{ steps.previous_tag.outputs.previous }}" ]; then |
115 | | - echo "No previous tag found: generating changelog for all commits." |
116 | | - cz changelog --dry-run > RELEASE_NOTES.md |
117 | | - else |
118 | | - echo "Previous tag found: generating changelog diff." |
119 | | - cz changelog --dry-run --rev-range ${{ steps.previous_tag.outputs.previous }}..${GITHUB_REF_NAME} > RELEASE_NOTES.md |
120 | | - fi |
121 | | -
|
122 | | - - name: Create GitHub Release |
123 | | - uses: softprops/action-gh-release@v2 |
124 | | - with: |
125 | | - tag_name: ${{ steps.get_tag.outputs.tag }} |
126 | | - name: Release ${{ steps.get_tag.outputs.tag }} |
127 | | - body: ${{ needs.build_and_testpypi.outputs.changelog_body }} |
128 | | - files: dist/* |
129 | | - prerelease: ${{ contains(steps.get_tag.outputs.tag, '-') }} # Checks if tag contains hyphen (e.g. v1.0.0-rc.1) |
0 commit comments