|
5 | 5 | # - https://github.com/docker/build-push-action/#usage
|
6 | 6 | # - https://docs.github.com/en/actions/publishing-packages/publishing-docker-images
|
7 | 7 |
|
8 |
| -name: Release |
| 8 | +name: release |
9 | 9 |
|
10 | 10 | "on":
|
11 | 11 | release:
|
12 | 12 | types: [published]
|
13 | 13 |
|
| 14 | + # we do not build and push images for every commit, only for tagged releases. |
| 15 | + # uncomment this to enablle building for pull requests, to debug this |
| 16 | + # workflow. |
| 17 | + # |
| 18 | + # pull_request: |
| 19 | + # branches: [main] |
| 20 | + |
14 | 21 | jobs:
|
15 | 22 | docker:
|
16 | 23 | runs-on: ubuntu-latest
|
| 24 | + |
| 25 | + permissions: |
| 26 | + contents: read |
| 27 | + packages: write |
| 28 | + |
17 | 29 | steps:
|
18 | 30 | - uses: actions/checkout@v4
|
19 |
| - - uses: docker/setup-qemu-action@v2 |
20 |
| - - uses: docker/setup-buildx-action@v2 |
| 31 | + - uses: docker/setup-qemu-action@v3 |
| 32 | + - uses: docker/setup-buildx-action@v3 |
21 | 33 |
|
22 |
| - - uses: docker/login-action@v2 |
| 34 | + - uses: docker/login-action@v3 |
23 | 35 | with:
|
24 | 36 | username: ${{ secrets.DOCKERHUB_USERNAME }}
|
25 | 37 | password: ${{ secrets.DOCKERHUB_TOKEN }}
|
26 | 38 |
|
27 |
| - - uses: docker/login-action@v2 |
| 39 | + - uses: docker/login-action@v3 |
28 | 40 | with:
|
29 | 41 | registry: ghcr.io
|
30 | 42 | username: ${{ github.repository_owner }}
|
31 | 43 | password: ${{ secrets.GITHUB_TOKEN }}
|
32 | 44 |
|
33 |
| - - uses: docker/metadata-action@v4 |
| 45 | + - uses: docker/metadata-action@v5 |
34 | 46 | with:
|
35 | 47 | images: |
|
36 | 48 | mccutchen/go-httpbin
|
37 | 49 | ghcr.io/${{ github.repository }}
|
| 50 | + tags: | |
| 51 | + # For releases, use the standard tags and special "latest" tag |
| 52 | + type=semver,pattern={{version}},enable=${{ github.event_name == 'release' }} |
| 53 | + type=semver,pattern={{major}}.{{minor}},enable=${{ github.event_name == 'release' }} |
| 54 | + type=raw,value=latest,enable=${{ github.event_name == 'release' }} |
| 55 | +
|
| 56 | + # For pull requests, use the commit SHA |
| 57 | + # |
| 58 | + # Note that this is disabled by default, but can be enabled for |
| 59 | + # debugging purposes by uncommenting the pull_request trigger at |
| 60 | + # top of the workflow. |
| 61 | + type=sha,format=short,enable=${{ github.event_name == 'pull_request' }} |
38 | 62 | id: meta
|
39 | 63 |
|
40 |
| - - uses: docker/build-push-action@v3 |
| 64 | + - uses: docker/build-push-action@v6 |
41 | 65 | with:
|
42 | 66 | platforms: linux/amd64,linux/arm64
|
43 | 67 | push: true
|
| 68 | + sbom: true |
| 69 | + provenance: mode=max |
44 | 70 | tags: ${{ steps.meta.outputs.tags }}
|
45 | 71 | labels: ${{ steps.meta.outputs.labels }}
|
| 72 | + annotations: ${{ steps.meta.outputs.annotations }} |
0 commit comments