@@ -2,8 +2,7 @@ name: docker-build
22
33on :
44 push :
5- branches :
6- - main
5+ pull_request :
76
87jobs :
98 multi-arch-push :
1211 -
1312 name : Checkout
1413 uses : actions/checkout@v4
15- with :
16- fetch-depth : 0
1714 -
1815 name : Set up Docker Buildx
1916 uses : docker/setup-buildx-action@v3
20- -
21- name : Cache Docker layers
22- uses : actions/cache@v4
23- with :
24- path : /tmp/.buildx-cache
25- key : ${{ runner.os }}-buildx-${{ github.sha }}
26- restore-keys : |
27- ${{ runner.os }}-buildx-
2817 -
2918 name : Login to GitHub Registry
3019 uses : docker/login-action@v3
@@ -39,21 +28,24 @@ jobs:
3928 username : erisamoe
4029 password : ${{ secrets.DOCKERHUB_TOKEN }}
4130 -
42- name : Get Latest Tag
43- id : previoustag
44- uses :
WyriHaximus/github-action-get-previous-tag@04e8485ecb6487243907e330d522ff60f02283ce # [email protected] 45- -
31+ if : github.ref == 'ref/heads/main'
4632 name : Build and push
47- uses : docker/build-push-action@v5
33+ uses : docker/bake-action@v6
34+ env :
35+ MULTI_PLATFORM : true
4836 with :
49- context : .
50- file : ./Dockerfile
51- platforms : linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6,linux/s390x,linux/ppc64le,linux/riscv64
5237 push : true
53- tags : |
54- erisamoe/cloudflared:latest
55- erisamoe/cloudflared:${{ steps.previoustag.outputs.tag }}
56- ghcr.io/erisa/cloudflared:latest
57- ghcr.io/erisa/cloudflared:${{ steps.previoustag.outputs.tag }}
58- cache-from : type=local,src=/tmp/.buildx-cache
59- cache-to : type=local,dest=/tmp/.buildx-cache
38+ set : |
39+ *.cache-from=type=registry,ref=user/app:latest
40+ *.cache-to=type=inline
41+ -
42+ if : github.ref != 'ref/heads/main'
43+ name : Build test image
44+ uses : docker/bake-action@v6
45+ env :
46+ MULTI_PLATFORM : true
47+ with :
48+ push : false
49+ set : |
50+ *.cache-from=type=registry,ref=user/app:latest
51+ *.cache-to=type=inline
0 commit comments