|
18 | 18 | branches: |
19 | 19 | - 'master' |
20 | 20 |
|
21 | | -env: |
22 | | - DOCKERHUB_SLUG: crazymax/7zip |
23 | | - GHCR_SLUG: ghcr.io/crazy-max/7zip |
24 | | - |
25 | 21 | jobs: |
26 | 22 | build: |
27 | | - runs-on: ubuntu-latest |
28 | | - permissions: |
29 | | - # same as global permissions |
30 | | - contents: read |
31 | | - # required to push to GHCR |
32 | | - packages: write |
33 | | - steps: |
34 | | - - |
35 | | - name: Docker meta |
36 | | - id: meta |
37 | | - uses: docker/metadata-action@v5 |
38 | | - with: |
39 | | - images: | |
40 | | - ${{ env.DOCKERHUB_SLUG }} |
41 | | - ${{ env.GHCR_SLUG }} |
42 | | - tags: | |
43 | | - type=match,pattern=(.*)-r,group=1 |
44 | | - type=ref,event=pr |
45 | | - type=edge |
46 | | - labels: | |
47 | | - org.opencontainers.image.title=7-Zip |
48 | | - org.opencontainers.image.description=File archiver with a high compression ratio |
49 | | - org.opencontainers.image.vendor=CrazyMax |
50 | | - - |
51 | | - name: Set up QEMU |
52 | | - uses: docker/setup-qemu-action@v3 |
53 | | - - |
54 | | - name: Set up Docker Buildx |
55 | | - uses: docker/setup-buildx-action@v3 |
56 | | - - |
57 | | - name: Login to DockerHub |
58 | | - if: github.event_name != 'pull_request' |
59 | | - uses: docker/login-action@v3 |
60 | | - with: |
61 | | - username: ${{ secrets.DOCKER_USERNAME }} |
62 | | - password: ${{ secrets.DOCKER_PASSWORD }} |
63 | | - - |
64 | | - name: Login to GHCR |
65 | | - if: github.event_name != 'pull_request' |
66 | | - uses: docker/login-action@v3 |
67 | | - with: |
68 | | - registry: ghcr.io |
69 | | - username: ${{ github.repository_owner }} |
70 | | - password: ${{ secrets.GITHUB_TOKEN }} |
71 | | - - |
72 | | - name: Build |
73 | | - uses: docker/bake-action@v6 |
74 | | - with: |
75 | | - files: | |
76 | | - ./docker-bake.hcl |
77 | | - cwd://${{ steps.meta.outputs.bake-file }} |
78 | | - targets: image-all |
79 | | - push: ${{ github.event_name != 'pull_request' }} |
80 | | - - |
81 | | - name: Check manifest |
82 | | - if: github.event_name != 'pull_request' |
83 | | - run: | |
84 | | - docker buildx imagetools inspect ${{ env.DOCKERHUB_SLUG }}:${{ steps.meta.outputs.version }} |
85 | | - docker buildx imagetools inspect ${{ env.GHCR_SLUG }}:${{ steps.meta.outputs.version }} |
86 | | - - |
87 | | - name: Inspect image |
88 | | - if: github.event_name != 'pull_request' |
89 | | - run: | |
90 | | - docker pull ${{ env.DOCKERHUB_SLUG }}:${{ steps.meta.outputs.version }} |
91 | | - docker image inspect ${{ env.DOCKERHUB_SLUG }}:${{ steps.meta.outputs.version }} |
92 | | - docker pull ${{ env.GHCR_SLUG }}:${{ steps.meta.outputs.version }} |
93 | | - docker image inspect ${{ env.GHCR_SLUG }}:${{ steps.meta.outputs.version }} |
| 23 | + uses: crazy-max/docker-bake-action/.github/workflows/distribute.yml@distribute-workflow |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + include: |
| 28 | + - image: crazymax/7zip |
| 29 | + login-registry: docker.io |
| 30 | + login-username: crazymax |
| 31 | + login-secret-key: DOCKER_PASSWORD |
| 32 | + - image: ghcr.io/crazy-max/7zip |
| 33 | + login-registry: ghcr.io |
| 34 | + login-username: ${{ github.repository_owner }} |
| 35 | + login-secret-key: GITHUB_TOKEN |
| 36 | + with: |
| 37 | + target: image-all |
| 38 | + push: ${{ github.event_name != 'pull_request' }} |
| 39 | + meta-image: ${{ matrix.image }} |
| 40 | + meta-tags: | |
| 41 | + type=match,pattern=(.*)-r,group=1 |
| 42 | + type=ref,event=pr |
| 43 | + type=edge |
| 44 | + meta-labels: | |
| 45 | + org.opencontainers.image.title=7-Zip |
| 46 | + org.opencontainers.image.description=File archiver with a high compression ratio |
| 47 | + org.opencontainers.image.vendor=CrazyMax |
| 48 | + login-username: ${{ matrix.image }} |
| 49 | + secrets: |
| 50 | + login-password: ${{ secrets[matrix.login-secret-key] }} |
0 commit comments