File tree 1 file changed +25
-6
lines changed
1 file changed +25
-6
lines changed Original file line number Diff line number Diff line change 6
6
build_app :
7
7
runs-on : ubuntu-22.04
8
8
steps :
9
- - uses : actions/checkout@v3
10
-
11
9
- name : Set up Go
12
10
uses : actions/setup-go@v3
13
11
with :
14
12
go-version : 1.19
15
13
14
+ - id : go-cache-paths
15
+ run : |
16
+ echo "::set-output name=go-build::$(go env GOCACHE)"
17
+ echo "::set-output name=go-mod::$(go env GOMODCACHE)"
18
+
19
+ - uses : actions/checkout@v3
20
+
21
+ - name : Go Build Cache
22
+ uses : actions/cache@v3
23
+ with :
24
+ path : ${{ steps.go-cache-paths.outputs.go-build }}
25
+ key : ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
26
+
27
+ - name : Go Mod Cache
28
+ uses : actions/cache@v3
29
+ with :
30
+ path : ${{ steps.go-cache-paths.outputs.go-mod }}
31
+ key : ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
32
+
16
33
- name : Build
17
34
run : GOFLAGS=-v make build
18
35
19
36
- name : Test
20
37
run : GOFLAGS=-v make test
21
38
22
39
23
- publish_container_image :
40
+ build_container_image :
24
41
needs : build_app
25
- if : github.ref == 'refs/heads/main'
26
42
runs-on : ubuntu-22.04
27
43
steps :
28
44
- uses : actions/checkout@v3
46
62
id : set_output_vars
47
63
run : echo "short_sha=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_OUTPUT
48
64
49
- - name : Build and push
65
+ - name : Build / Push
50
66
uses : docker/build-push-action@v4
51
67
with :
52
- push : true
68
+ context : .
69
+ cache-from : type=gha
70
+ cache-to : type=gha,mode=max
71
+ push : ${{ github.ref == 'ref/heads/main' }}
53
72
platforms : linux/amd64,linux/arm64
54
73
tags : ${{ vars.DOCKER_IMAGE_NAME }}:${{ steps.set_output_vars.outputs.short_sha }}
You can’t perform that action at this time.
0 commit comments