Skip to content

Commit e4dd8af

Browse files
committed
chore: try this type of build
1 parent 8b1aa5a commit e4dd8af

File tree

2 files changed

+50
-10
lines changed

2 files changed

+50
-10
lines changed
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ jobs:
3232
username: ${{ secrets.DOCKERHUB_USERNAME }}
3333
password: ${{ secrets.DOCKERHUB_TOKEN }}
3434

35+
- run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
36+
3537
- name: Docker Build and Push
3638
uses: docker/build-push-action@v5
3739
with:
@@ -41,6 +43,6 @@ jobs:
4143
tags: |
4244
doseidotio/dashboard
4345
doseidotio/dashboard:${{ github.sha }}
44-
doseidotio/dashboard:${{ github.ref_name }}
46+
doseidotio/dashboard:${{ env.VERSION }}
4547
cache-from: type=gha
4648
cache-to: type=gha,mode=max

.github/workflows/doseid.yml

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ concurrency:
99
group: doseid-${{ github.ref }}
1010

1111
jobs:
12-
build-and-push:
12+
build:
1313
runs-on: ${{ matrix.runner }}
1414
strategy:
1515
matrix:
@@ -18,7 +18,9 @@ jobs:
1818
platform: linux/amd64
1919
- runner: ubuntu-24.04-arm
2020
platform: linux/arm64
21-
21+
outputs:
22+
amd64-digest: ${{ steps.export-amd64.outputs.digest }}
23+
arm64-digest: ${{ steps.export-arm64.outputs.digest }}
2224
steps:
2325
- name: Checkout
2426
uses: actions/checkout@v4
@@ -32,15 +34,51 @@ jobs:
3234
username: ${{ secrets.DOCKERHUB_USERNAME }}
3335
password: ${{ secrets.DOCKERHUB_TOKEN }}
3436

35-
- name: Docker Build and Push
37+
- name: Build and push
38+
id: build
3639
uses: docker/build-push-action@v5
3740
with:
3841
context: .
3942
push: true
4043
platforms: ${{ matrix.platform }}
41-
tags: |
42-
doseidotio/doseid
43-
doseidotio/doseid:${{ github.sha }}
44-
doseidotio/doseid:${{ github.ref_name }}
45-
cache-from: type=gha
46-
cache-to: type=gha,mode=max
44+
outputs: type=image,name=doseidotio/doseid,push-by-digest=true,name-canonical=true
45+
cache-from: type=gha,scope=${{ matrix.platform }}
46+
cache-to: type=gha,mode=max,scope=${{ matrix.platform }}
47+
48+
- name: Export digest (AMD64)
49+
if: matrix.platform == 'linux/amd64'
50+
id: export-amd64
51+
run: |
52+
echo "digest=${{ steps.build.outputs.digest }}" >> $GITHUB_OUTPUT
53+
54+
- name: Export digest (ARM64)
55+
if: matrix.platform == 'linux/arm64'
56+
id: export-arm64
57+
run: |
58+
echo "digest=${{ steps.build.outputs.digest }}" >> $GITHUB_OUTPUT
59+
60+
merge:
61+
runs-on: ubuntu-latest
62+
needs: build
63+
steps:
64+
- name: Login to Docker Hub
65+
uses: docker/login-action@v3
66+
with:
67+
username: ${{ secrets.DOCKERHUB_USERNAME }}
68+
password: ${{ secrets.DOCKERHUB_TOKEN }}
69+
70+
- run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
71+
72+
- name: Create multi-arch manifest
73+
run: |
74+
docker buildx imagetools create -t doseidotio/doseid \
75+
${{ needs.build.outputs.amd64-digest }} \
76+
${{ needs.build.outputs.arm64-digest }}
77+
78+
docker buildx imagetools create -t doseidotio/doseid:${{ github.sha }} \
79+
${{ needs.build.outputs.amd64-digest }} \
80+
${{ needs.build.outputs.arm64-digest }}
81+
82+
docker buildx imagetools create -t doseidotio/doseid:${{ env.VERSION }} \
83+
${{ needs.build.outputs.amd64-digest }} \
84+
${{ needs.build.outputs.arm64-digest }}

0 commit comments

Comments
 (0)