|
1 | | -name: build |
| 1 | +name: Build |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | workflow_dispatch: |
5 | 5 | push: |
6 | 6 | branches: |
7 | 7 | - "**" |
| 8 | + paths-ignore: |
| 9 | + - 'README.md' |
8 | 10 |
|
9 | 11 | env: |
10 | 12 | REGISTRY: ghcr.io |
11 | 13 | IMAGE_NAME: ${{ github.repository }} |
12 | 14 |
|
13 | 15 | jobs: |
14 | | - build-x86: |
15 | | - runs-on: ubuntu-latest |
| 16 | + build: |
| 17 | + runs-on: ${{ matrix.os }} |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + include: |
| 22 | + - os: ubuntu-latest |
| 23 | + arch: amd64 |
| 24 | + platform: linux/amd64 |
| 25 | + - os: ubuntu-24.04-arm |
| 26 | + arch: arm64 |
| 27 | + platform: linux/arm64 |
16 | 28 | permissions: |
17 | 29 | contents: read |
18 | 30 | packages: write |
19 | 31 | steps: |
20 | | - - uses: actions/checkout@v3 |
| 32 | + - name: Prepare |
| 33 | + run: | |
| 34 | + platform=${{ matrix.platform }} |
| 35 | + echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV |
| 36 | + - uses: actions/checkout@v4 |
21 | 37 | - name: Log in to the Container registry |
22 | | - uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 |
| 38 | + uses: docker/login-action@v3 |
23 | 39 | with: |
24 | 40 | registry: ${{ env.REGISTRY }} |
25 | 41 | username: ${{ github.actor }} |
26 | 42 | password: ${{ secrets.GITHUB_TOKEN }} |
27 | | - - name: Set up Docker Buildx |
28 | | - uses: docker/setup-buildx-action@v2 |
29 | | - |
30 | 43 | - name: Extract metadata (tags, labels) for Docker |
31 | 44 | id: meta |
32 | | - uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 |
| 45 | + uses: docker/metadata-action@v5 |
33 | 46 | with: |
34 | 47 | images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
35 | | - |
36 | | - - name: Build and push Docker image |
37 | | - uses: docker/build-push-action@v4 |
38 | | - with: |
39 | | - context: . |
40 | | - platforms: linux/amd64 |
41 | | - push: true |
42 | | - tags: ${{ steps.meta.outputs.tags }} |
43 | | - labels: ${{ steps.meta.outputs.labels }} |
44 | | - |
45 | | - build-arm: |
46 | | - runs-on: ubuntu-latest |
47 | | - permissions: |
48 | | - contents: read |
49 | | - packages: write |
50 | | - steps: |
51 | | - - uses: actions/checkout@v3 |
52 | | - - name: Log in to the Container registry |
53 | | - uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 |
54 | | - with: |
55 | | - registry: ${{ env.REGISTRY }} |
56 | | - username: ${{ github.actor }} |
57 | | - password: ${{ secrets.GITHUB_TOKEN }} |
58 | | - - name: Set up QEMU |
59 | | - uses: docker/setup-qemu-action@v3 |
60 | 48 | - name: Set up Docker Buildx |
61 | | - uses: docker/setup-buildx-action@v2 |
62 | | - |
63 | | - - name: Extract metadata (tags, labels) for Docker |
64 | | - id: meta |
65 | | - uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 |
66 | | - with: |
67 | | - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
68 | | - |
| 49 | + uses: docker/setup-buildx-action@v3 |
69 | 50 | - name: Build and push Docker image |
70 | | - uses: docker/build-push-action@v4 |
| 51 | + uses: docker/build-push-action@v6 |
71 | 52 | with: |
72 | 53 | context: . |
73 | | - platforms: linux/arm64 |
| 54 | + platforms: ${{ matrix.platform }} |
74 | 55 | push: true |
75 | | - tags: ${{ steps.meta.outputs.tags }}-arm64 |
76 | | - labels: ${{ steps.meta.outputs.labels }}-arm64 |
| 56 | + tags: ${{ steps.meta.outputs.tags }}-${{ env.PLATFORM_PAIR }} |
| 57 | + labels: ${{ steps.meta.outputs.labels }}-${{ env.PLATFORM_PAIR }} |
| 58 | + cache-from: type=gha |
| 59 | + cache-to: type=gha,mode=max |
0 commit comments