Skip to content

Commit fa8b140

Browse files
authored
Multi-arch build
1 parent 556a873 commit fa8b140

1 file changed

Lines changed: 40 additions & 27 deletions

File tree

.github/workflows/publish.yml

Lines changed: 40 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,48 @@ on:
77

88
env:
99
REGISTRY: ghcr.io
10+
PLATFORMS: linux/amd64,linux/aarch64
1011

1112
jobs:
1213
deploy:
1314
runs-on: ubuntu-latest
14-
permissions: write-all
15+
permissions:
16+
contents: read
17+
packages: write
1518
steps:
16-
- uses: actions/checkout@v4
17-
- name: Set up Docker Buildx
18-
uses: docker/setup-buildx-action@v3
19-
20-
- name: Login to GitHub Container Registry
21-
uses: docker/login-action@v3
22-
with:
23-
registry: ghcr.io
24-
username: ${{ github.actor }}
25-
password: ${{ secrets.GITHUB_TOKEN }}
26-
27-
- name: Get version
28-
id: "discovery-version"
29-
shell: "bash"
30-
run: |
31-
echo PKG_VERSION="0.1.1" >> $GITHUB_OUTPUT
32-
33-
- name: Build image
34-
run: |
35-
docker build . -t ghcr.io/turmsapp/discovery:latest
36-
docker tag ghcr.io/turmsapp/discovery:latest ghcr.io/turmsapp/discovery:${{ steps.discovery-version.outputs.PKG_VERSION }}
37-
38-
- name: Publish images
39-
run: |
40-
docker push ghcr.io/turmsapp/discovery:latest
41-
docker push ghcr.io/turmsapp/discovery:${{ steps.discovery-version.outputs.PKG_VERSION }}
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v3
23+
24+
- name: Login to GitHub Container Registry
25+
uses: docker/login-action@v3
26+
with:
27+
registry: ${{ env.REGISTRY }}
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Get version
32+
id: "discovery-version"
33+
shell: "bash"
34+
run: |
35+
PKG_VERSION="0.1.2"
36+
echo "PKG_VERSION=${PKG_VERSION}" >> $GITHUB_OUTPUT
37+
38+
- name: Set image tags
39+
id: meta
40+
uses: docker/metadata-action@v5
41+
with:
42+
images: ${{ env.REGISTRY }}/${{ github.repository }}
43+
tags: |
44+
type=raw,value=latest
45+
type=raw,value=${{ steps.discovery-version.outputs.PKG_VERSION }}
46+
47+
- name: Build and Push Multi-Platform Image
48+
uses: docker/build-push-action@v5
49+
with:
50+
context: .
51+
push: true
52+
platforms: ${{ env.PLATFORMS }}
53+
tags: ${{ steps.meta.outputs.tags }}
54+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)