|
1 | 1 | name: Docker |
2 | | - |
3 | 2 | on: |
4 | 3 | push: |
5 | | - branches: [ "main" ] |
| 4 | + branches: ["main"] |
6 | 5 | # Publish semver tags as releases. |
7 | | - tags: [ 'v*.*.*' ] |
| 6 | + tags: ['v*.*.*'] |
8 | 7 | pull_request: |
9 | | - branches: [ "main" ] |
10 | | - |
| 8 | + branches: ["main"] |
11 | 9 | env: |
12 | 10 | REGISTRY: ghcr.io |
13 | 11 | IMAGE_NAME: ${{ github.repository }} |
14 | | - |
15 | 12 | jobs: |
16 | 13 | build-and-push-image: |
17 | 14 | runs-on: ubuntu-latest |
18 | 15 | permissions: |
19 | 16 | contents: read |
20 | 17 | packages: write |
21 | | - |
22 | 18 | steps: |
23 | 19 | - name: Checkout repository |
24 | 20 | uses: actions/checkout@v3 |
25 | | - |
26 | | - - name: Setup Docker buildx |
27 | | - uses: docker/setup-buildx-action@v2.4.1 |
28 | | - |
| 21 | + - name: Set up Docker Buildx |
| 22 | + uses: docker/setup-buildx-action@v3 |
29 | 23 | - name: Log into registry ${{ env.REGISTRY }} |
30 | 24 | if: github.event_name != 'pull_request' |
31 | 25 | uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 |
32 | 26 | with: |
33 | 27 | registry: ${{ env.REGISTRY }} |
34 | 28 | username: ${{ github.actor }} |
35 | 29 | password: ${{ secrets.GITHUB_TOKEN }} |
36 | | - |
37 | 30 | - name: Extract metadata (tags, labels) for Docker |
38 | 31 | id: meta |
39 | 32 | uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 |
40 | 33 | with: |
41 | 34 | images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
42 | | - |
43 | 35 | - name: Build and push Docker image |
44 | | - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc |
| 36 | + uses: docker/build-push-action@v6 |
45 | 37 | with: |
46 | 38 | context: . |
47 | 39 | platforms: linux/amd64,linux/arm64 |
48 | 40 | push: ${{ github.event_name != 'pull_request' }} |
49 | 41 | tags: ${{ steps.meta.outputs.tags }} |
50 | 42 | labels: ${{ steps.meta.outputs.labels }} |
| 43 | + cache-from: type=gha |
| 44 | + cache-to: type=gha,mode=max |
0 commit comments