|
9 | 9 | build:
|
10 | 10 | runs-on: ubuntu-latest
|
11 | 11 | steps:
|
| 12 | + - name: Checkout |
| 13 | + uses: actions/checkout@v4 |
12 | 14 | - name: Get git tag
|
13 | 15 | id: tag
|
14 | 16 | uses: dawidd6/action-get-tag@v1
|
15 | 17 | with:
|
16 | 18 | strip_v: true
|
17 | 19 | - name: Set up QEMU
|
18 |
| - uses: docker/setup-qemu-action@v2 |
| 20 | + uses: docker/setup-qemu-action@v3 |
19 | 21 | - name: Set up Docker Buildx
|
20 |
| - uses: docker/setup-buildx-action@v2 |
| 22 | + uses: docker/setup-buildx-action@v3 |
21 | 23 | - name: Login to DockerHub
|
22 |
| - uses: docker/login-action@v2.0.0 |
| 24 | + uses: docker/login-action@v3 |
23 | 25 | with:
|
24 | 26 | username: ${{ secrets.DOCKER_USER }}
|
25 | 27 | password: ${{ secrets.DOCKER_PASSWORD }}
|
26 | 28 | - name: Login to GitHub Container Registry
|
27 |
| - uses: docker/login-action@v2.0.0 |
| 29 | + uses: docker/login-action@v3 |
28 | 30 | with:
|
29 | 31 | registry: ghcr.io
|
30 | 32 | username: ${{ github.repository_owner }}
|
31 |
| - password: ${{ github.token }} |
| 33 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 34 | + - name: Extract metadata |
| 35 | + id: meta |
| 36 | + uses: docker/metadata-action@v5 |
| 37 | + with: |
| 38 | + images: | |
| 39 | + timothyye/godns |
| 40 | + ghcr.io/timothyye/godns |
| 41 | + tags: | |
| 42 | + type=ref,event=tag |
| 43 | + type=raw,value=latest,enable={{is_default_branch}} |
32 | 44 | - name: Build and push the docker image
|
33 |
| - uses: docker/build-push-action@v3 |
| 45 | + uses: docker/build-push-action@v6 |
34 | 46 | with:
|
| 47 | + context: . |
35 | 48 | platforms: linux/amd64,linux/arm64
|
36 | 49 | push: true
|
37 |
| - tags: | |
38 |
| - timothyye/godns:latest |
39 |
| - timothyye/godns:${{steps.tag.outputs.tag}} |
40 |
| - ghcr.io/timothyye/godns:latest |
41 |
| - ghcr.io/timothyye/godns:${{steps.tag.outputs.tag}} |
| 50 | + tags: ${{ steps.meta.outputs.tags }} |
| 51 | + labels: ${{ steps.meta.outputs.labels }} |
42 | 52 | build-args: |
|
43 | 53 | VERSION=v${{ steps.tag.outputs.tag }}
|
| 54 | + cache-from: type=gha |
| 55 | + cache-to: type=gha,mode=max |
0 commit comments