Skip to content

Commit 9b7bb33

Browse files
authored
Use GitHub cache backend API (#128)
1 parent ffcc9d1 commit 9b7bb33

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ jobs:
5050
steps:
5151
- name: Checkout Repository
5252
uses: actions/checkout@v2
53+
- name: Determine Go version from go.mod
54+
run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV
5355
- name: Setup Golang Environment
5456
uses: actions/setup-go@v2
5557
with:
@@ -71,24 +73,15 @@ jobs:
7173
key: nginx-asg-sync-${{ github.run_id }}-${{ github.run_number }}
7274
- name: Docker Buildx
7375
uses: docker/setup-buildx-action@v1
74-
with:
75-
driver-opts: network=host
76-
- name: Cache Docker layers
77-
uses: actions/cache@v2.1.6
78-
with:
79-
path: /tmp/.buildx-cache
80-
key: ${{ runner.os }}-buildx-${{ github.sha }}
81-
restore-keys: |
82-
${{ runner.os }}-buildx-
8376
- name: Build Image Amazon 1
8477
uses: docker/build-push-action@v2
8578
with:
8679
file: build/Dockerfile
8780
context: '.'
8881
target: local
8982
load: true
90-
cache-from: type=local,src=/tmp/.buildx-cache
91-
cache-to: type=local,dest=/tmp/.buildx-cache
83+
cache-from: type=gha
84+
cache-to: type=gha,mode=max
9285
tags: amazon-builder:${{ github.sha }}
9386
build-args: |
9487
CONTAINER_VERSION=amazonlinux:1
@@ -106,8 +99,8 @@ jobs:
10699
context: '.'
107100
target: local
108101
load: true
109-
cache-from: type=local,src=/tmp/.buildx-cache
110-
cache-to: type=local,dest=/tmp/.buildx-cache
102+
cache-from: type=gha
103+
cache-to: type=gha,mode=max
111104
tags: amazon2-builder:${{ github.sha }}
112105
build-args: |
113106
CONTAINER_VERSION=amazonlinux:2
@@ -125,8 +118,8 @@ jobs:
125118
context: '.'
126119
target: local
127120
load: true
128-
cache-from: type=local,src=/tmp/.buildx-cache
129-
cache-to: type=local,dest=/tmp/.buildx-cache
121+
cache-from: type=gha
122+
cache-to: type=gha,mode=max
130123
tags: centos7-builder:${{ github.sha }}
131124
build-args: |
132125
CONTAINER_VERSION=centos:7
@@ -144,8 +137,8 @@ jobs:
144137
context: '.'
145138
target: local
146139
load: true
147-
cache-from: type=local,src=/tmp/.buildx-cache
148-
cache-to: type=local,dest=/tmp/.buildx-cache
140+
cache-from: type=gha
141+
cache-to: type=gha,mode=max
149142
tags: centos8-builder:${{ github.sha }}
150143
build-args: |
151144
CONTAINER_VERSION=centos:8
@@ -163,8 +156,8 @@ jobs:
163156
context: '.'
164157
target: local
165158
load: true
166-
cache-from: type=local,src=/tmp/.buildx-cache
167-
cache-to: type=local,dest=/tmp/.buildx-cache
159+
cache-from: type=gha
160+
cache-to: type=gha,mode=max
168161
tags: debian-builder:${{ github.sha }}
169162
build-args: |
170163
OS_TYPE=deb_based

0 commit comments

Comments
 (0)