|
1 | 1 | name: release |
2 | 2 | on: |
3 | 3 | push: |
4 | | - tags: ['v*'] |
| 4 | + tags: |
| 5 | + - 'v*' # only version tags |
5 | 6 |
|
6 | 7 | permissions: |
7 | 8 | contents: read |
8 | 9 | packages: write |
9 | 10 |
|
10 | | -concurrency: |
11 | | - group: release-${{ github.ref }} |
12 | | - cancel-in-progress: true |
13 | | - |
14 | 11 | jobs: |
15 | 12 | ghcr: |
16 | | - name: Publish GHCR |
17 | 13 | runs-on: ubuntu-latest |
18 | 14 | steps: |
19 | 15 | - uses: actions/checkout@v4 |
20 | | - - name: Compute image name (lowercase) |
| 16 | + |
| 17 | + - name: Set image name (lowercase) |
21 | 18 | shell: bash |
22 | | - run: echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY@L}" >> "$GITHUB_ENV" |
23 | | - - uses: docker/setup-qemu-action@v3 |
| 19 | + run: echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY,,}" >> "$GITHUB_ENV" |
| 20 | + |
24 | 21 | - uses: docker/setup-buildx-action@v3 |
25 | 22 | - uses: docker/login-action@v3 |
26 | 23 | with: |
27 | 24 | registry: ghcr.io |
28 | 25 | username: ${{ github.actor }} |
29 | 26 | password: ${{ secrets.GITHUB_TOKEN }} |
| 27 | + |
30 | 28 | - uses: docker/build-push-action@v6 |
31 | 29 | with: |
32 | 30 | context: . |
| 31 | + file: ./Dockerfile |
33 | 32 | platforms: linux/amd64 |
34 | 33 | push: true |
35 | 34 | provenance: false |
36 | | - tags: ${{ env.IMAGE }}:latest,${{ env.IMAGE }}:${{ github.ref_name }} |
37 | | - |
38 | | - pypi: |
39 | | - name: Publish PyPI (guarded) |
40 | | - if: ${{ secrets.PYPI_API_TOKEN != '' }} |
41 | | - needs: ghcr |
42 | | - runs-on: ubuntu-latest |
43 | | - permissions: |
44 | | - contents: read |
45 | | - steps: |
46 | | - - uses: actions/checkout@v4 |
47 | | - - uses: actions/setup-python@v5 |
48 | | - with: { python-version: '3.12' } |
49 | | - - name: Build sdist/wheel |
50 | | - run: | |
51 | | - python -m pip install -U pip build |
52 | | - python -m build |
53 | | - - uses: pypa/gh-action-pypi-publish@release/v1 |
54 | | - with: |
55 | | - user: __token__ |
56 | | - password: ${{ secrets.PYPI_API_TOKEN }} |
| 35 | + tags: | |
| 36 | + ${{ env.IMAGE }}:latest |
| 37 | + ${{ env.IMAGE }}:${{ github.ref_name }} |
0 commit comments