Skip to content

Commit bc3ee19

Browse files
committed
Try new publish workflow
1 parent bee8af1 commit bc3ee19

File tree

1 file changed

+46
-12
lines changed

1 file changed

+46
-12
lines changed

.github/workflows/publish_docker.yml

+46-12
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ env:
1515
IMAGE_NAME: ${{ github.repository }}
1616

1717
jobs:
18-
build-and-push-image:
19-
runs-on: ubuntu-latest
18+
build:
19+
strategy:
20+
matrix:
21+
os: ["ubuntu-latest", "ubuntu-24.04-arm"]
22+
runs-on: ${{ matrix.os }}
23+
2024
permissions:
2125
contents: read
2226
packages: write
@@ -38,11 +42,19 @@ jobs:
3842
username: ${{ github.actor }}
3943
password: ${{ secrets.GITHUB_TOKEN }}
4044

45+
- name: Set architecture tag (amd64)
46+
if: ${{ matrix.os == 'ubuntu-latest' }}
47+
run: echo "ARCH_TAG=amd64" >> $GITHUB_ENV
48+
49+
- name: Set architecture tag (arm64)
50+
if: ${{ contains(matrix.os, 'arm') }}
51+
run: echo "ARCH_TAG=arm64" >> $GITHUB_ENV
52+
4153
- name: Extract metadata (tags, labels) for Docker
4254
id: meta
4355
uses: docker/metadata-action@v5
4456
with:
45-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
57+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ matrix.os }}
4658

4759
- name: Build Docker image
4860
uses: docker/build-push-action@v6
@@ -54,14 +66,36 @@ jobs:
5466
platforms: linux/amd64
5567
tags: ${{ steps.meta.outputs.tags }}
5668
labels: ${{ steps.meta.outputs.labels }}
69+
outputs: type=docker, dest=${{ runner.temp }}/image.tar
5770

58-
- name: Build (arm) and push (amd/arm) Docker image
59-
uses: docker/build-push-action@v6
60-
if: github.event_name == 'push'
71+
- name: Upload artifact
72+
uses: actions/upload-artifact@v4
6173
with:
62-
context: .
63-
push: true
64-
file: docker/Dockerfile
65-
platforms: linux/amd64,linux/arm64
66-
tags: ${{ steps.meta.outputs.tags }}
67-
labels: ${{ steps.meta.outputs.labels }}
74+
name: ${{ matrix.os}}
75+
path: ${{ runner.temp }}/image.tar
76+
77+
push:
78+
runs-on: ubuntu-latest
79+
needs: build
80+
steps:
81+
- name: Download (AMD) artifact
82+
uses: actions/download-artifact@v4
83+
with:
84+
name: "ubuntu-latest"
85+
path: ${{ runner.temp }}
86+
87+
- name: Load image (amd)
88+
run: |
89+
docker load --input ${{ runner.temp }}/ubuntu-latest.tar
90+
docker image ls -a
91+
92+
- name: Download (ARM) artifact
93+
uses: actions/download-artifact@v4
94+
with:
95+
name: "ubuntu-24.04-arm"
96+
path: ${{ runner.temp }}
97+
98+
- name: Load image (arm)
99+
run: |
100+
docker load --input ${{ runner.temp }}/ubuntu-24.04-arm.tar
101+
docker image ls -a

0 commit comments

Comments
 (0)