Skip to content

Commit 062d1a6

Browse files
committed
Try to merge images
1 parent cc54250 commit 062d1a6

1 file changed

Lines changed: 63 additions & 9 deletions

File tree

.github/workflows/release.yml

Lines changed: 63 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: PyPI and Helm Releases
22

33
on:
44
workflow_call:
5+
pull_request:
56

67
env:
78
GCP_WORKLOAD_IDENTITY_PROVIDER: "projects/224545243904/locations/global/workloadIdentityPools/gh-nuclia/providers/gh-nuclia-provider"
@@ -89,13 +90,15 @@ jobs:
8990

9091
push-docker:
9192
name: Build public docker image
92-
runs-on: ${{ matrix.runner }}
93+
runs-on: ${{ matrix.arch.runner }}
9394
strategy:
9495
fail-fast: false
9596
matrix:
96-
runner:
97-
- ubuntu-24.04
98-
- ubuntu-24.04-arm
97+
arch:
98+
- runner: ubuntu-24.04
99+
tag: amd64
100+
- runner: ubuntu-24.04-arm
101+
tag: arm64
99102
image:
100103
- name: nucliadb
101104
dockerfile: Dockerfile.withbinding
@@ -129,18 +132,69 @@ jobs:
129132
echo "version_number=$VERSION" >> $GITHUB_OUTPUT
130133
echo "hash=$HASH" >> $GITHUB_OUTPUT
131134
132-
- name: Build and push
135+
- id: build
136+
name: Build and push
133137
uses: docker/build-push-action@v4
134138
with:
135139
context: .
136140
file: ${{ matrix.image.dockerfile }}
137141
push: true
138-
tags: |
139-
nuclia/${{ matrix.image.name }}:latest
140-
nuclia/${{ matrix.image.name }}:${{ steps.version_step.outputs.version_number }}
141-
nuclia/${{ matrix.image.name }}:${{ steps.version_step.outputs.hash }}
142+
tags: nuclia/${{ matrix.image.name }}
142143
cache-from: type=gha
143144
cache-to: type=gha,mode=min
145+
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
146+
147+
- name: Export digest
148+
run: echo "${{ steps.build.outputs.digest }}" > /tmp/digest-${{ matrix.image.name }}-${{ matrix.arch.tag }}
149+
150+
- name: Upload digest
151+
uses: actions/upload-artifact@v4
152+
with:
153+
name: digests-${{ matrix.image.name }}-${{ matrix.arch.tag }}
154+
path: /tmp/digest-${{ matrix.image.name }}-${{ matrix.arch.tag }}
155+
if-no-files-found: error
156+
retention-days: 1
157+
158+
merge-docker:
159+
runs-on: ubuntu-latest
160+
needs:
161+
- push-docker
162+
strategy:
163+
matrix:
164+
image:
165+
- nucliadb
166+
- nidx
167+
steps:
168+
- name: Download digests
169+
uses: actions/download-artifact@v4
170+
with:
171+
path: /tmp/digests
172+
pattern: digests-${{ matrix.image }}-*
173+
merge-multiple: true
174+
175+
- name: Login to DockerHub
176+
uses: docker/login-action@v2
177+
with:
178+
username: ${{ secrets.DOCKERHUB_USERNAME }}
179+
password: ${{ secrets.DOCKERHUB_TOKEN }}
180+
181+
- name: Set up Docker Buildx
182+
uses: docker/setup-buildx-action@v3
183+
184+
- name: Create manifest list and push
185+
run: ls /tmp/digests
186+
187+
- name: Create manifest list and push
188+
run: cat /tmp/digests/*
189+
190+
- name: Create manifest list and push
191+
working-directory: /tmp/digests
192+
run: >
193+
docker buildx imagetools create
194+
--tag nuclia/${{ matrix.image }}:latest
195+
--tag nuclia/${{ matrix.image }}:${{ steps.version_step.outputs.version_number }}
196+
--tag nuclia/${{ matrix.image }}:${{ steps.version_step.outputs.hash }}
197+
$(printf 'nuclia/${{ matrix.image }}@%s ' $(cat *))
144198
145199
deploy:
146200
name: Deploy Helm chart and trigger internal CI

0 commit comments

Comments
 (0)