|
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 |
| - |
10 |
| - Build: |
| 8 | + build: |
| 9 | + name: Build |
11 | 10 | runs-on: ubuntu-latest
|
12 |
| - |
13 | 11 | steps:
|
14 |
| - - uses: actions/checkout@v4 |
15 |
| - - name: Get tag |
16 |
| - id: tag |
17 |
| - run: | |
18 |
| - echo tag=${GITHUB_REF#refs/tags/} >> $GITHUB_OUTPUT |
19 |
| -
|
20 |
| - - name: Set up Python ${{ matrix.python-version }} |
21 |
| - uses: actions/setup-python@v5 |
22 |
| - with: |
23 |
| - python-version: "3.10" |
24 |
| - |
25 |
| - - name: Install and set up Poetry |
26 |
| - run: | |
27 |
| - curl -sL https://install.python-poetry.org | python - -y |
| 12 | + - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 |
28 | 13 |
|
29 |
| - - name: Update PATH |
30 |
| - shell: bash |
31 |
| - run: echo "$HOME/.local/bin" >> $GITHUB_PATH |
| 14 | + - run: pipx run build |
32 | 15 |
|
33 |
| - - name: Build distributions |
34 |
| - run: | |
35 |
| - poetry build -vvv |
36 |
| -
|
37 |
| - - name: Upload distribution artifacts |
38 |
| - uses: actions/upload-artifact@v4 |
39 |
| - with: |
40 |
| - name: project-dist |
41 |
| - path: dist |
| 16 | + - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 |
| 17 | + with: |
| 18 | + name: distfiles |
| 19 | + path: dist/ |
| 20 | + if-no-files-found: error |
42 | 21 |
|
43 |
| - Publish: |
44 |
| - needs: [Build] |
| 22 | + upload-github: |
| 23 | + name: Upload (GitHub) |
45 | 24 | runs-on: ubuntu-latest
|
46 |
| - |
| 25 | + permissions: |
| 26 | + contents: write |
| 27 | + needs: build |
47 | 28 | steps:
|
48 |
| - - name: Checkout code |
49 |
| - uses: actions/checkout@v4 |
50 |
| - - name: Get tag |
51 |
| - id: tag |
52 |
| - run: | |
53 |
| - echo tag=${GITHUB_REF#refs/tags/} >> $GITHUB_OUTPUT |
| 29 | + # We need to be in a git repo for gh to work. |
| 30 | + - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 |
54 | 31 |
|
55 |
| - - name: Download distribution artifact |
56 |
| - uses: actions/download-artifact@master |
| 32 | + - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 |
57 | 33 | with:
|
58 |
| - name: project-dist |
59 |
| - path: dist |
60 |
| - |
61 |
| - - name: Install and set up Poetry |
62 |
| - run: | |
63 |
| - curl -sL https://install.python-poetry.org | python - -y |
| 34 | + name: distfiles |
| 35 | + path: dist/ |
64 | 36 |
|
65 |
| - - name: Update PATH |
66 |
| - shell: bash |
67 |
| - run: echo "$HOME/.local/bin" >> $GITHUB_PATH |
68 |
| - |
69 |
| - - name: Check distributions |
70 |
| - run: | |
71 |
| - ls -la dist |
72 |
| -
|
73 |
| - - name: Publish to PyPI |
| 37 | + - run: gh release upload ${{ github.event.release.tag_name }} dist/*.{tar.gz,whl} |
74 | 38 | env:
|
75 |
| - POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} |
76 |
| - run: | |
77 |
| - poetry publish |
| 39 | + GH_TOKEN: ${{ github.token }} |
78 | 40 |
|
79 |
| - - name: Create Release |
80 |
| - id: create_release |
81 |
| - uses: actions/create-release@v1 |
82 |
| - env: |
83 |
| - GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} |
| 41 | + upload-pypi: |
| 42 | + name: Upload (PyPI) |
| 43 | + runs-on: ubuntu-latest |
| 44 | + environment: |
| 45 | + name: pypi |
| 46 | + url: https://pypi.org/project/cleo/ |
| 47 | + permissions: |
| 48 | + id-token: write |
| 49 | + needs: build |
| 50 | + steps: |
| 51 | + - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 |
| 52 | + with: |
| 53 | + name: distfiles |
| 54 | + path: dist/ |
| 55 | + |
| 56 | + - uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # v1.8.14 |
84 | 57 | with:
|
85 |
| - tag_name: ${{ steps.tag.outputs.tag }} |
86 |
| - release_name: ${{ steps.tag.outputs.tag }} |
87 |
| - draft: false |
88 |
| - prerelease: false |
| 58 | + print-hash: true |
0 commit comments