|
1 | 1 | name: Release |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - tags: |
6 | | - - "*.*.*" |
| 4 | + release: |
| 5 | + types: [published] |
7 | 6 |
|
8 | 7 | jobs: |
9 | | - release: |
10 | | - name: Release |
| 8 | + build: |
| 9 | + name: Build |
11 | 10 | runs-on: ubuntu-latest |
12 | 11 | steps: |
13 | | - - name: Checkout code |
14 | | - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
| 12 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
15 | 13 |
|
16 | | - - name: Set up Python 3.10 |
17 | | - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 |
18 | | - with: |
19 | | - python-version: "3.10" |
| 14 | + - run: pipx run build |
20 | 15 |
|
21 | | - - name: Install Poetry |
22 | | - run: | |
23 | | - curl -sSL https://install.python-poetry.org | python - -y |
| 16 | + - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 |
| 17 | + with: |
| 18 | + name: distfiles |
| 19 | + path: dist/ |
| 20 | + if-no-files-found: error |
24 | 21 |
|
25 | | - - name: Update PATH |
26 | | - run: echo "$HOME/.local/bin" >> $GITHUB_PATH |
| 22 | + upload-github: |
| 23 | + name: Upload (GitHub) |
| 24 | + runs-on: ubuntu-latest |
| 25 | + permissions: |
| 26 | + contents: write |
| 27 | + needs: build |
| 28 | + steps: |
| 29 | + # We need to be in a git repo for gh to work. |
| 30 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
27 | 31 |
|
28 | | - - name: Build project for distribution |
29 | | - run: poetry build |
| 32 | + - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 |
| 33 | + with: |
| 34 | + name: distfiles |
| 35 | + path: dist/ |
30 | 36 |
|
31 | | - - name: Check Version |
32 | | - id: check-version |
33 | | - run: | |
34 | | - [[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] \ |
35 | | - || echo prerelease=true >> $GITHUB_OUTPUT |
| 37 | + - run: gh release upload ${{ github.event.release.tag_name }} dist/*.{tar.gz,whl} |
| 38 | + env: |
| 39 | + GH_TOKEN: ${{ github.token }} |
36 | 40 |
|
37 | | - - name: Create Release |
38 | | - uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 |
| 41 | + upload-pypi: |
| 42 | + name: Upload (PyPI) |
| 43 | + runs-on: ubuntu-latest |
| 44 | + environment: |
| 45 | + name: pypi |
| 46 | + url: https://pypi.org/project/poetry-plugin-bundle/ |
| 47 | + permissions: |
| 48 | + id-token: write |
| 49 | + needs: build |
| 50 | + steps: |
| 51 | + - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 |
39 | 52 | with: |
40 | | - artifacts: "dist/*" |
41 | | - token: ${{ secrets.GITHUB_TOKEN }} |
42 | | - draft: false |
43 | | - prerelease: steps.check-version.outputs.prerelease == 'true' |
| 53 | + name: distfiles |
| 54 | + path: dist/ |
44 | 55 |
|
45 | | - - name: Publish to PyPI |
46 | | - env: |
47 | | - POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} |
48 | | - run: poetry publish |
| 56 | + - uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc # v1.12.2 |
| 57 | + with: |
| 58 | + print-hash: true |
0 commit comments