Skip to content

Commit b0160f8

Browse files
committed
ci: build linux/amd64,linux/arm64 docker images
1 parent bac73f2 commit b0160f8

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

.github/workflows/publish.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- master
7+
release:
8+
types: [published]
79

810
jobs:
911
push_to_registry:
@@ -17,19 +19,29 @@ jobs:
1719
steps:
1820
- name: Checkout
1921
uses: actions/checkout@v4
20-
- name: Login to GitHub Container Registry
22+
- name: Set up QEMU
23+
uses: docker/setup-qemu-action@v2
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v2
26+
- name: Login to Docker Hub
2127
uses: docker/login-action@v3
2228
with:
23-
registry: ${{ env.REGISTRY }}
2429
username: ${{ secrets.DOCKERHUB_USERNAME }}
2530
password: ${{ secrets.DOCKERHUB_TOKEN }}
31+
- name: Extract version tag
32+
id: extract_tag
33+
if: github.event_name == 'release'
34+
run: echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
2635
- name: Build and push image
2736
id: push
2837
uses: docker/[email protected]
2938
with:
3039
context: .
3140
push: true
32-
tags: sjdonado/url-shortener:latest
41+
platforms: linux/amd64,linux/arm64
42+
tags: |
43+
sjdonado/url-shortener:latest
44+
${{ github.event_name == 'release' && 'sjdonado/url-shortener:${{ env.RELEASE_TAG }}' || '' }}
3345
- name: Attest
3446
uses: actions/attest-build-provenance@v1
3547
id: attest

0 commit comments

Comments
 (0)