2222 runs-on : macos-11
2323 steps :
2424 - name : Checkout
25- uses : actions/checkout@v2
25+ uses : actions/checkout@v3
2626 - name : Test build script for darwin-amd64 - libgit2-all
2727 run : |
2828 make dev-test
@@ -46,20 +46,20 @@ jobs:
4646 - 5000:5000
4747 steps :
4848 - name : Checkout
49- uses : actions/checkout@v2
49+ uses : actions/checkout@v3
5050 - name : Unshallow
5151 run : git fetch --prune --unshallow
5252 - name : Setup Cosign
5353 uses : sigstore/cosign-installer@main
5454 - name : Set up QEMU
5555 id : qemu
56- uses : docker/setup-qemu-action@v1
56+ uses : docker/setup-qemu-action@v2
5757 with :
5858 image : tonistiigi/binfmt:latest
5959 platforms : ${{ env.PLATFORMS }}
6060 - name : Set up Docker Buildx
6161 id : buildx
62- uses : docker/setup-buildx-action@v1
62+ uses : docker/setup-buildx-action@v2
6363 with :
6464 config-inline : |
6565 [worker.oci]
7373 echo "Flags: ${{ steps.buildx.outputs.flags }}"
7474 echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
7575 - name : Cache Docker layers
76- uses : actions/cache@v2
76+ uses : actions/cache@v3
7777 id : cache
7878 with :
7979 path : /tmp/.buildx-cache
8383 - run : cat ./hack/static.sh
8484 - name : Build candidate image - libgit2 compiled with libssh2 and openssl
8585 id : build_candidate_libgit2_all
86- uses : docker/build-push-action@v2
86+ uses : docker/build-push-action@v3
8787 with :
8888 context : .
8989 file : Dockerfile
@@ -92,26 +92,13 @@ jobs:
9292 tags : localhost:5000/${{ github.repository_owner }}/golang-with-libgit2-all:latest
9393 cache-from : type=local,src=/tmp/.buildx-cache
9494 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
10695 - name : Inspect candidate images
10796 run : |
10897 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
11098 - name : Test candidate images
11199 id : test_candidate
112100 run : |
113101 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
115102 - # Temp fix
116103 # https://github.com/docker/build-push-action/issues/252
117104 # https://github.com/moby/buildkit/issues/1896
@@ -121,7 +108,7 @@ jobs:
121108 mv /tmp/.buildx-cache-new /tmp/.buildx-cache
122109 - name : Login to GHCR
123110 if : github.event_name != 'pull_request'
124- uses : docker/login-action@v1
111+ uses : docker/login-action@v2
125112 with :
126113 registry : ghcr.io
127114 username : ${{ github.repository_owner }}
@@ -134,15 +121,13 @@ jobs:
134121 images : |
135122 ghcr.io/${{ github.repository_owner }}/golang-with-libgit2-all
136123 tags : |
137- type=schedule
138- type=ref,event=branch
139- type=ref,event=tag
124+ type=semver,pattern=v{{version}}
140125 type=sha
141126 type=sha,format=long
142127 - name : Release candidate image - golang-with-libgit2-all
143128 id : release_candidate_libgit2_all
144129 if : github.event_name != 'pull_request'
145- uses : docker/build-push-action@v2
130+ uses : docker/build-push-action@v3
146131 with :
147132 context : .
148133 file : Dockerfile
@@ -162,6 +147,85 @@ jobs:
162147 cosign sign $image
163148 done
164149
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+
165229 - name : Compose release candidate metadata - golang-with-libgit2-only
166230 id : meta_libgit2_only
167231 uses : docker/metadata-action@v3
@@ -170,15 +234,13 @@ jobs:
170234 images : |
171235 ghcr.io/${{ github.repository_owner }}/golang-with-libgit2-only
172236 tags : |
173- type=schedule
174- type=ref,event=branch
175- type=ref,event=tag
237+ type=semver,pattern=v{{version}}
176238 type=sha
177239 type=sha,format=long
178240 - name : Release candidate image - golang-with-libgit2-only
179241 id : release_candidate_libgit2_only
180242 if : github.event_name != 'pull_request'
181- uses : docker/build-push-action@v2
243+ uses : docker/build-push-action@v3
182244 with :
183245 context : .
184246 file : Dockerfile.libgit2-only
0 commit comments