|
7 | 7 | - master
|
8 | 8 |
|
9 | 9 | jobs:
|
10 |
| - release: |
11 |
| - name: Release |
| 10 | + tag-and-build: |
| 11 | + name: Tag and build |
12 | 12 | runs-on: ubuntu-latest
|
13 | 13 | permissions: write-all
|
14 | 14 |
|
| 15 | + outputs: |
| 16 | + tag: ${{ steps.tag-step.outputs.tag }} |
| 17 | + |
15 | 18 | steps:
|
16 | 19 | - name: Check out the repository
|
17 | 20 |
|
@@ -48,29 +51,47 @@ jobs:
|
48 | 51 | version=$(hatch version) &&
|
49 | 52 | hatch version $version$(date +%s)
|
50 | 53 |
|
| 54 | + - name: Publish the release notes |
| 55 | + uses: release-drafter/[email protected] |
| 56 | + with: |
| 57 | + publish: ${{ steps.check-version.outputs.tag != '' }} |
| 58 | + tag: ${{ steps.check-version.outputs.tag }} |
| 59 | + env: |
| 60 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 61 | + |
51 | 62 | - name: Build package
|
52 | 63 | run: |
|
53 | 64 | hatch build
|
54 | 65 |
|
55 |
| - - name: Publish package on PyPI |
56 |
| - if: steps.check-version.outputs.tag |
57 |
| - |
| 66 | + - name: Store tag |
| 67 | + id: tag-step |
| 68 | + run: echo "tag=${{ steps.check-version.outputs.tag }}" >> "$GITHUB_OUTPUT" |
| 69 | + |
| 70 | + - name: Upload release artifacts |
| 71 | + uses: actions/upload-artifact@v4 |
58 | 72 | with:
|
59 |
| - user: __token__ |
60 |
| - password: ${{ secrets.PYPI_TOKEN }} |
| 73 | + name: release-artifacts |
| 74 | + path: dist/ |
| 75 | + |
| 76 | + pypi-publish: |
| 77 | + name: Publish to PyPI |
| 78 | + needs: [tag-and-build] |
| 79 | + environment: |
| 80 | + name: release |
| 81 | + url: https://pypi.org/p/protosym |
| 82 | + permissions: |
| 83 | + id-token: write |
| 84 | + runs-on: ubuntu-latest |
| 85 | + |
| 86 | + steps: |
| 87 | + - run: echo "Tag = ${{ needs.tag-and-build.outputs.tag }}" |
| 88 | + |
| 89 | + - name: Publish package on PyPI |
| 90 | + if: needs.tag-and-build.outputs.tag |
| 91 | + uses: pypa/gh-action-pypi-publish@release/v1 |
61 | 92 |
|
62 | 93 | - name: Publish package on TestPyPI
|
63 |
| - if: "! steps.check-version.outputs.tag" |
64 |
| - uses: pypa/gh-action-pypi-publish@v1.8.12 |
| 94 | + if: "! needs.tag-and-build.outputs.tag" |
| 95 | + uses: pypa/gh-action-pypi-publish@release/v1 |
65 | 96 | with:
|
66 |
| - user: __token__ |
67 |
| - password: ${{ secrets.TEST_PYPI_TOKEN }} |
68 | 97 | repository_url: https://test.pypi.org/legacy/
|
69 |
| - |
70 |
| - - name: Publish the release notes |
71 |
| - uses: release-drafter/[email protected] |
72 |
| - with: |
73 |
| - publish: ${{ steps.check-version.outputs.tag != '' }} |
74 |
| - tag: ${{ steps.check-version.outputs.tag }} |
75 |
| - env: |
76 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
|
0 commit comments