@@ -3,44 +3,50 @@ name: Build Multi-Arch Docker Image
3
3
on :
4
4
push :
5
5
tags : " [1-9]+.[0-9]+.[0-9]+"
6
-
6
+ env :
7
+ REGISTRY : ghcr.io
8
+ IMAGE_NAME : ${{ github.repository }}
9
+
7
10
jobs :
8
11
docker :
9
12
runs-on : ubuntu-latest
13
+ permissions :
14
+ packages : write
15
+ contents : read
10
16
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
+
29
29
with :
30
- registry : ghcr.io
31
- username : ${{ github.repository_owner }}
30
+ registry : ${{ env.REGISTRY }}
31
+ username : ${{ github.actor }}
32
32
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
35
41
id : get_version
36
42
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
40
46
with :
41
47
context : .
42
48
platforms : linux/amd64,linux/arm64
43
49
push : true
44
50
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