@@ -31,12 +31,28 @@ jobs:
3131 - uses : actions/checkout@v4
3232 with :
3333 fetch-depth : ' 0'
34+
3435 - uses : actions/setup-go@v5
3536 with :
3637 go-version : ${{ env.GO_VERSION }}
37- cache-dependency-path : |
38- **/go.sum
39- go.work.sum
38+ cache : false
39+
40+ - name : Create Go cache directories
41+ run : |
42+ mkdir -p ~/go/pkg/mod
43+ mkdir -p ~/.cache/go-build
44+
45+ - name : Cache Go modules and build cache
46+ uses : actions/cache@v4
47+ with :
48+ path : |
49+ ~/go/pkg/mod
50+ ~/.cache/go-build
51+ key : ${{ runner.os }}-go-detect-${{ hashFiles('**/go.sum', 'go.work.sum') }}
52+ restore-keys : |
53+ ${{ runner.os }}-go-detect-
54+ ${{ runner.os }}-go-
55+
4056 - name : detect-services
4157 id : detect-services
4258 env :
@@ -45,13 +61,14 @@ jobs:
4561 services=$(go run builder/main.go)
4662 echo "Raw services output: $services"
4763 echo "services=$services" >> $GITHUB_OUTPUT
64+
4865 - name : print-services
4966 run : |
5067 echo "Services: ${{ steps.detect-services.outputs.services }}"
5168
5269 docker-build-and-publish :
5370 needs : [ detect-services ]
54- if : needs.detect-services.outputs.services != '[]' # Only run if there are services to build
71+ if : needs.detect-services.outputs.services != '[]'
5572 runs-on : ubuntu-latest
5673 strategy :
5774 matrix :
@@ -63,21 +80,28 @@ jobs:
6380 token : ${{ secrets.VAULT_TOKEN }}
6481 path : global/github
6582 - uses : actions/checkout@v4
83+
6684 - uses : actions/setup-go@v5
6785 with :
6886 go-version : ${{ env.GO_VERSION }}
69- cache : true
70- cache-dependency-path : go.sum
87+ cache : false # Disable built-in cache, we'll handle it manually
88+
89+ # Create cache directories before restoring
90+ - name : Create Go cache directories
91+ run : |
92+ mkdir -p ~/go/pkg/mod
93+ mkdir -p ~/.cache/go-build
7194
72- # Cache Go build cache (separate from module cache)
73- - name : Cache Go build cache
95+ - name : Cache Go modules and build cache
7496 uses : actions/cache@v4
7597 with :
76- path : ~/.cache/go-build
77- key : ${{ runner.os }}-go-build-${{ matrix.service }}-${{ hashFiles('**/go.sum') }}
98+ path : |
99+ ~/go/pkg/mod
100+ ~/.cache/go-build
101+ key : ${{ runner.os }}-go-${{ matrix.service }}-${{ hashFiles('**/go.sum', 'go.work.sum') }}
78102 restore-keys : |
79- ${{ runner.os }}-go-build- ${{ matrix.service }}-
80- ${{ runner.os }}-go-build-
103+ ${{ runner.os }}-go-${{ matrix.service }}-
104+ ${{ runner.os }}-go-
81105
82106 - uses : ko-build/setup-ko@v0.8
83107 env :
0 commit comments