@@ -3,64 +3,31 @@ name: Build and Push
33on :
44 push :
55 branches : [main]
6- workflow_dispatch :
7-
8- env :
9- REGISTRY : ghcr.io
10- IMAGE : ghcr.io/lawndlwd/quizz
11-
12- permissions :
13- contents : read
14- packages : write
156
167jobs :
178 build :
18- strategy :
19- matrix :
20- runner :
21- - os : ubuntu-24.04
22- platform : linux/amd64
23- suffix : amd64
24- - os : ubuntu-24.04-arm
25- platform : linux/arm64
26- suffix : arm64
27- runs-on : ${{ matrix.runner.os }}
9+ runs-on : ubuntu-latest
10+ permissions :
11+ contents : read
12+ packages : write
2813
2914 steps :
30- - uses : actions/checkout@v4
15+ - name : Checkout
16+ uses : actions/checkout@v4
17+
18+ - name : Set image name
19+ run : echo "IMAGE=ghcr.io/$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]'):latest" >> $GITHUB_ENV
3120
32- - uses : docker/login-action@v3
21+ - name : Log in to GitHub Container Registry
22+ uses : docker/login-action@v3
3323 with :
34- registry : ${{ env.REGISTRY }}
24+ registry : ghcr.io
3525 username : ${{ github.actor }}
3626 password : ${{ secrets.GITHUB_TOKEN }}
3727
38- - uses : docker/setup-buildx-action@v3
39-
40- - uses : docker/build-push-action@v6
28+ - name : Build and push
29+ uses : docker/build-push-action@v6
4130 with :
4231 context : .
43- platforms : ${{ matrix.runner.platform }}
4432 push : true
45- tags : ${{ env.IMAGE }}:${{ github.sha }}-${{ matrix.runner.suffix }}
46- cache-from : type=gha,scope=quizz-${{ matrix.runner.suffix }}
47- cache-to : type=gha,mode=max,scope=quizz-${{ matrix.runner.suffix }}
48-
49- merge :
50- needs : build
51- runs-on : ubuntu-24.04
52-
53- steps :
54- - uses : docker/login-action@v3
55- with :
56- registry : ${{ env.REGISTRY }}
57- username : ${{ github.actor }}
58- password : ${{ secrets.GITHUB_TOKEN }}
59-
60- - name : Create multi-arch manifest
61- run : |
62- docker buildx imagetools create \
63- -t ${{ env.IMAGE }}:latest \
64- -t ${{ env.IMAGE }}:${{ github.sha }} \
65- ${{ env.IMAGE }}:${{ github.sha }}-amd64 \
66- ${{ env.IMAGE }}:${{ github.sha }}-arm64
33+ tags : ${{ env.IMAGE }}
0 commit comments