22
22
runs-on : macos-11
23
23
steps :
24
24
- name : Checkout
25
- uses : actions/checkout@v2
25
+ uses : actions/checkout@v3
26
26
- name : Test build script for darwin-amd64 - libgit2-all
27
27
run : |
28
28
make dev-test
@@ -46,20 +46,20 @@ jobs:
46
46
- 5000:5000
47
47
steps :
48
48
- name : Checkout
49
- uses : actions/checkout@v2
49
+ uses : actions/checkout@v3
50
50
- name : Unshallow
51
51
run : git fetch --prune --unshallow
52
52
- name : Setup Cosign
53
53
uses : sigstore/cosign-installer@main
54
54
- name : Set up QEMU
55
55
id : qemu
56
- uses : docker/setup-qemu-action@v1
56
+ uses : docker/setup-qemu-action@v2
57
57
with :
58
58
image : tonistiigi/binfmt:latest
59
59
platforms : ${{ env.PLATFORMS }}
60
60
- name : Set up Docker Buildx
61
61
id : buildx
62
- uses : docker/setup-buildx-action@v1
62
+ uses : docker/setup-buildx-action@v2
63
63
with :
64
64
config-inline : |
65
65
[worker.oci]
73
73
echo "Flags: ${{ steps.buildx.outputs.flags }}"
74
74
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
75
75
- name : Cache Docker layers
76
- uses : actions/cache@v2
76
+ uses : actions/cache@v3
77
77
id : cache
78
78
with :
79
79
path : /tmp/.buildx-cache
83
83
- run : cat ./hack/static.sh
84
84
- name : Build candidate image - libgit2 compiled with libssh2 and openssl
85
85
id : build_candidate_libgit2_all
86
- uses : docker/build-push-action@v2
86
+ uses : docker/build-push-action@v3
87
87
with :
88
88
context : .
89
89
file : Dockerfile
@@ -92,26 +92,13 @@ jobs:
92
92
tags : localhost:5000/${{ github.repository_owner }}/golang-with-libgit2-all:latest
93
93
cache-from : type=local,src=/tmp/.buildx-cache
94
94
cache-to : type=local,dest=/tmp/.buildx-cache-new,mode=max
95
- - name : Build candidate image - libgit2 only
96
- id : build_candidate_libgti2_only
97
- uses : docker/build-push-action@v2
98
- with :
99
- context : .
100
- file : Dockerfile.libgit2-only
101
- platforms : ${{ env.PLATFORMS }}
102
- push : true
103
- tags : localhost:5000/${{ github.repository_owner }}/golang-with-libgit2-only:latest
104
- cache-from : type=local,src=/tmp/.buildx-cache
105
- cache-to : type=local,dest=/tmp/.buildx-cache-new,mode=max
106
95
- name : Inspect candidate images
107
96
run : |
108
97
docker buildx imagetools inspect localhost:5000/${{ github.repository_owner }}/golang-with-libgit2-all:latest
109
- docker buildx imagetools inspect localhost:5000/${{ github.repository_owner }}/golang-with-libgit2-only:latest
110
98
- name : Test candidate images
111
99
id : test_candidate
112
100
run : |
113
101
IMG=localhost:5000/${{ github.repository_owner }}/golang-with-libgit2-all make test
114
- IMG=localhost:5000/${{ github.repository_owner }}/golang-with-libgit2-only LIBGIT2_ONLY=true make test
115
102
- # Temp fix
116
103
# https://github.com/docker/build-push-action/issues/252
117
104
# https://github.com/moby/buildkit/issues/1896
@@ -121,7 +108,7 @@ jobs:
121
108
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
122
109
- name : Login to GHCR
123
110
if : github.event_name != 'pull_request'
124
- uses : docker/login-action@v1
111
+ uses : docker/login-action@v2
125
112
with :
126
113
registry : ghcr.io
127
114
username : ${{ github.repository_owner }}
@@ -134,15 +121,13 @@ jobs:
134
121
images : |
135
122
ghcr.io/${{ github.repository_owner }}/golang-with-libgit2-all
136
123
tags : |
137
- type=schedule
138
- type=ref,event=branch
139
- type=ref,event=tag
124
+ type=semver,pattern=v{{version}}
140
125
type=sha
141
126
type=sha,format=long
142
127
- name : Release candidate image - golang-with-libgit2-all
143
128
id : release_candidate_libgit2_all
144
129
if : github.event_name != 'pull_request'
145
- uses : docker/build-push-action@v2
130
+ uses : docker/build-push-action@v3
146
131
with :
147
132
context : .
148
133
file : Dockerfile
@@ -162,6 +147,85 @@ jobs:
162
147
cosign sign $image
163
148
done
164
149
150
+ build-libgit2-only :
151
+ runs-on : ubuntu-latest
152
+ env :
153
+ PLATFORMS : linux/amd64,linux/arm/v7,linux/arm64
154
+ services :
155
+ registry :
156
+ image : registry:2
157
+ ports :
158
+ - 5000:5000
159
+ steps :
160
+ - name : Checkout
161
+ uses : actions/checkout@v3
162
+ - name : Unshallow
163
+ run : git fetch --prune --unshallow
164
+ - name : Setup Cosign
165
+ uses : sigstore/cosign-installer@main
166
+ - name : Set up QEMU
167
+ id : qemu
168
+ uses : docker/setup-qemu-action@v2
169
+ with :
170
+ image : tonistiigi/binfmt:latest
171
+ platforms : ${{ env.PLATFORMS }}
172
+ - name : Set up Docker Buildx
173
+ id : buildx
174
+ uses : docker/setup-buildx-action@v2
175
+ with :
176
+ config-inline : |
177
+ [worker.oci]
178
+ max-parallelism = 4
179
+ driver-opts : network=host
180
+ - name : Inspect builder
181
+ run : |
182
+ echo "Name: ${{ steps.buildx.outputs.name }}"
183
+ echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
184
+ echo "Status: ${{ steps.buildx.outputs.status }}"
185
+ echo "Flags: ${{ steps.buildx.outputs.flags }}"
186
+ echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
187
+ - name : Cache Docker layers
188
+ uses : actions/cache@v3
189
+ id : cache
190
+ with :
191
+ path : /tmp/.buildx-cache
192
+ key : ${{ runner.os }}-buildx-ghcache-${{ github.sha }}
193
+ restore-keys : |
194
+ ${{ runner.os }}-buildx-ghcache-
195
+ - run : cat ./hack/static.sh
196
+ - name : Build candidate image - libgit2 only
197
+ id : build_candidate_libgti2_only
198
+ uses : docker/build-push-action@v3
199
+ with :
200
+ context : .
201
+ file : Dockerfile.libgit2-only
202
+ platforms : ${{ env.PLATFORMS }}
203
+ push : true
204
+ tags : localhost:5000/${{ github.repository_owner }}/golang-with-libgit2-only:latest
205
+ cache-from : type=local,src=/tmp/.buildx-cache
206
+ cache-to : type=local,dest=/tmp/.buildx-cache-new,mode=max
207
+ - name : Inspect candidate images
208
+ run : |
209
+ docker buildx imagetools inspect localhost:5000/${{ github.repository_owner }}/golang-with-libgit2-only:latest
210
+ - name : Test candidate images
211
+ id : test_candidate
212
+ run : |
213
+ IMG=localhost:5000/${{ github.repository_owner }}/golang-with-libgit2-only LIBGIT2_ONLY=true make test
214
+ - # Temp fix
215
+ # https://github.com/docker/build-push-action/issues/252
216
+ # https://github.com/moby/buildkit/issues/1896
217
+ name : Move cache
218
+ run : |
219
+ rm -rf /tmp/.buildx-cache
220
+ mv /tmp/.buildx-cache-new /tmp/.buildx-cache
221
+ - name : Login to GHCR
222
+ if : github.event_name != 'pull_request'
223
+ uses : docker/login-action@v2
224
+ with :
225
+ registry : ghcr.io
226
+ username : ${{ github.repository_owner }}
227
+ password : ${{ secrets.GITHUB_TOKEN }}
228
+
165
229
- name : Compose release candidate metadata - golang-with-libgit2-only
166
230
id : meta_libgit2_only
167
231
uses : docker/metadata-action@v3
@@ -170,15 +234,13 @@ jobs:
170
234
images : |
171
235
ghcr.io/${{ github.repository_owner }}/golang-with-libgit2-only
172
236
tags : |
173
- type=schedule
174
- type=ref,event=branch
175
- type=ref,event=tag
237
+ type=semver,pattern=v{{version}}
176
238
type=sha
177
239
type=sha,format=long
178
240
- name : Release candidate image - golang-with-libgit2-only
179
241
id : release_candidate_libgit2_only
180
242
if : github.event_name != 'pull_request'
181
- uses : docker/build-push-action@v2
243
+ uses : docker/build-push-action@v3
182
244
with :
183
245
context : .
184
246
file : Dockerfile.libgit2-only
0 commit comments