Skip to content

Commit a8e5b27

Browse files
authored
fix: build pipeline
1 parent c7950bf commit a8e5b27

File tree

1 file changed

+34
-28
lines changed

1 file changed

+34
-28
lines changed

.github/workflows/docker-multiarch-build.yml

+34-28
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,50 @@ name: Build Multi-Arch Docker Image
33
on:
44
push:
55
tags: "[1-9]+.[0-9]+.[0-9]+"
6-
6+
env:
7+
REGISTRY: ghcr.io
8+
IMAGE_NAME: ${{ github.repository }}
9+
710
jobs:
811
docker:
912
runs-on: ubuntu-latest
13+
permissions:
14+
packages: write
15+
contents: read
1016
steps:
11-
-
12-
name: Checkout
13-
uses: actions/checkout@v2
14-
-
15-
name: Set up QEMU
16-
uses: docker/setup-qemu-action@v1
17-
-
18-
name: Set up Docker Buildx
19-
uses: docker/setup-buildx-action@v1
20-
-
21-
name: Login to DockerHub
22-
uses: docker/login-action@v1
23-
with:
24-
username: ${{ secrets.DOCKERHUB_USERNAME }}
25-
password: ${{ secrets.DOCKERHUB_TOKEN }}
26-
-
27-
name: Login to GitHub Container Registry
28-
uses: docker/login-action@v1
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Set up QEMU
21+
uses: docker/setup-qemu-action@v3
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
26+
- name: Log into registry ${{ env.REGISTRY }}
27+
if: github.event_name != 'pull_request'
28+
uses: docker/[email protected]
2929
with:
30-
registry: ghcr.io
31-
username: ${{ github.repository_owner }}
30+
registry: ${{ env.REGISTRY }}
31+
username: ${{ github.actor }}
3232
password: ${{ secrets.GITHUB_TOKEN }}
33-
-
34-
name: Get the version
33+
34+
- name: Extract Docker metadata
35+
id: meta
36+
uses: docker/metadata-action@v5
37+
with:
38+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
39+
40+
- name: Get the version
3541
id: get_version
3642
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
37-
-
38-
name: Build and push
39-
uses: docker/build-push-action@v2
43+
44+
- name: Build and push
45+
uses: docker/build-push-action@v5
4046
with:
4147
context: .
4248
platforms: linux/amd64,linux/arm64
4349
push: true
4450
tags: |
45-
ghcr.io/tobiaswx/manjaro-package-mirror:latest
46-
ghcr.io/tobiaswx/manjaro-package-mirror:${{ steps.get_version.outputs.VERSION }}
51+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
52+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.get_version.outputs.VERSION }}

0 commit comments

Comments
 (0)