Skip to content

Commit c454474

Browse files
committed
Try to merge images
1 parent cc54250 commit c454474

1 file changed

Lines changed: 69 additions & 9 deletions

File tree

.github/workflows/release.yml

Lines changed: 69 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,15 @@ jobs:
8989

9090
push-docker:
9191
name: Build public docker image
92-
runs-on: ${{ matrix.runner }}
92+
runs-on: ${{ matrix.arch.runner }}
9393
strategy:
9494
fail-fast: false
9595
matrix:
96-
runner:
97-
- ubuntu-24.04
98-
- ubuntu-24.04-arm
96+
arch:
97+
- runner: ubuntu-24.04
98+
tag: amd64
99+
- runner: ubuntu-24.04-arm
100+
tag: arm64
99101
image:
100102
- name: nucliadb
101103
dockerfile: Dockerfile.withbinding
@@ -129,18 +131,76 @@ jobs:
129131
echo "version_number=$VERSION" >> $GITHUB_OUTPUT
130132
echo "hash=$HASH" >> $GITHUB_OUTPUT
131133
132-
- name: Build and push
134+
- id: build
135+
name: Build and push
133136
uses: docker/build-push-action@v4
134137
with:
135138
context: .
136139
file: ${{ matrix.image.dockerfile }}
137140
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 }}
141+
tags: nuclia/${{ matrix.image.name }}
142142
cache-from: type=gha
143143
cache-to: type=gha,mode=min
144+
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
145+
146+
- name: Export digest
147+
run: echo "${{ steps.build.outputs.digest }}" > /tmp/digest-${{ matrix.image.name }}-${{ matrix.arch.tag }}
148+
149+
- name: Upload digest
150+
uses: actions/upload-artifact@v4
151+
with:
152+
name: digests-${{ matrix.image.name }}-${{ matrix.arch.tag }}
153+
path: /tmp/digest-${{ matrix.image.name }}-${{ matrix.arch.tag }}
154+
if-no-files-found: error
155+
retention-days: 1
156+
157+
merge-docker:
158+
runs-on: ubuntu-latest
159+
needs:
160+
- push-docker
161+
strategy:
162+
matrix:
163+
image:
164+
- nucliadb
165+
- nidx
166+
steps:
167+
- name: Checkout
168+
uses: actions/checkout@v4
169+
170+
- name: Get release version
171+
id: version_step
172+
run: |-
173+
python bump.py --build=${{github.run_number}}
174+
cargo update --manifest-path nidx/Cargo.toml nidx_binding
175+
VERSION=`cat VERSION`
176+
HASH=`git rev-parse --short HEAD`
177+
echo "version_number=$VERSION" >> $GITHUB_OUTPUT
178+
echo "hash=$HASH" >> $GITHUB_OUTPUT
179+
180+
- name: Download digests
181+
uses: actions/download-artifact@v4
182+
with:
183+
path: /tmp/digests
184+
pattern: digests-${{ matrix.image }}-*
185+
merge-multiple: true
186+
187+
- name: Login to DockerHub
188+
uses: docker/login-action@v2
189+
with:
190+
username: ${{ secrets.DOCKERHUB_USERNAME }}
191+
password: ${{ secrets.DOCKERHUB_TOKEN }}
192+
193+
- name: Set up Docker Buildx
194+
uses: docker/setup-buildx-action@v3
195+
196+
- name: Create manifest list and push
197+
working-directory: /tmp/digests
198+
run: >
199+
docker buildx imagetools create
200+
--tag nuclia/${{ matrix.image }}:latest
201+
--tag nuclia/${{ matrix.image }}:${{ steps.version_step.outputs.version_number }}
202+
--tag nuclia/${{ matrix.image }}:${{ steps.version_step.outputs.hash }}
203+
$(printf 'nuclia/${{ matrix.image }}@%s ' $(cat *))
144204
145205
deploy:
146206
name: Deploy Helm chart and trigger internal CI

0 commit comments

Comments
 (0)