|
1 | | -on: |
2 | | - release: |
3 | | - types: [published] |
| 1 | +name: Release |
4 | 2 |
|
5 | | -env: |
6 | | - AWS_DEFAULT_REGION: "us-east-1" |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + # Publish on any tag starting with a `v`, e.g. v1.2.3 |
| 7 | + - v* |
7 | 8 |
|
8 | 9 | jobs: |
9 | | - test: |
10 | | - runs-on: ubuntu-latest |
11 | | - steps: |
12 | | - - uses: actions/checkout@v2 |
13 | | - - uses: actions/setup-python@v2 |
14 | | - with: |
15 | | - python-version: "3.10" |
16 | | - - run: pip install -e .[dev] |
17 | | - - run: pytest |
18 | | - |
19 | | - test-release: |
20 | | - needs: test |
21 | | - runs-on: ubuntu-latest |
22 | | - |
23 | | - steps: |
24 | | - - uses: actions/checkout@v2 |
25 | | - |
26 | | - - uses: actions/setup-python@v2 |
27 | | - with: |
28 | | - python-version: "3.10" |
29 | | - |
30 | | - - name: Install dependencies |
31 | | - run: pip install -e .[dev] |
32 | | - |
33 | | - - name: Build dist |
34 | | - run: python -m build |
35 | | - |
36 | | - - name: Publish release to test PyPi |
37 | | - uses: pypa/gh-action-pypi-publish@release/v1 |
38 | | - with: |
39 | | - user: __token__ |
40 | | - password: ${{ secrets.TEST_PYPI_API_TOKEN }} |
41 | | - repository_url: https://test.pypi.org/legacy/ |
42 | | - |
43 | | - release: |
44 | | - needs: test-release |
| 10 | + pypi: |
| 11 | + name: Publish to PyPI |
45 | 12 | runs-on: ubuntu-latest |
| 13 | + environment: |
| 14 | + name: release |
| 15 | + permissions: |
| 16 | + id-token: write |
46 | 17 | steps: |
47 | | - - uses: actions/checkout@v2 |
48 | | - |
49 | | - - uses: actions/setup-python@v2 |
| 18 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
50 | 19 | with: |
51 | | - python-version: "3.10" |
52 | | - |
53 | | - - name: Install dependencies |
54 | | - run: pip install -e .[dev] |
55 | | - |
56 | | - - name: Build dist |
57 | | - run: python -m build |
58 | | - |
59 | | - - name: Publish release to test PyPi |
60 | | - uses: pypa/gh-action-pypi-publish@release/v1 |
| 20 | + persist-credentials: false |
| 21 | + - uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0 |
61 | 22 | with: |
62 | | - user: __token__ |
63 | | - password: ${{ secrets.PYPI_API_TOKEN }} |
| 23 | + enable-cache: false |
| 24 | + python-version: "3.12" |
| 25 | + version: "latest" |
| 26 | + - run: uv version "${GITHUB_REF_NAME}" |
| 27 | + - run: uv build |
| 28 | + - run: uv publish --trusted-publishing always --token "${secrets.PYPI_API_TOKEN}" |
0 commit comments