Skip to content

Commit 3bf32ee

Browse files
committed
CI: use reusable composite actions
1 parent 375aeb0 commit 3bf32ee

File tree

2 files changed

+59
-42
lines changed

2 files changed

+59
-42
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: 'Push Docker Multi-Arch Manifest'
2+
description: 'Create and push multi-architecture Docker manifest from digests'
3+
inputs:
4+
registry_image:
5+
description: 'Docker registry image name (e.g., o1labs/mina-rust)'
6+
required: true
7+
git_commit:
8+
description: 'Git commit or tag for image tagging'
9+
required: true
10+
digest_pattern:
11+
description: 'Pattern to match digest artifacts'
12+
required: true
13+
dockerhub_username:
14+
description: 'Docker Hub username'
15+
required: true
16+
dockerhub_token:
17+
description: 'Docker Hub token'
18+
required: true
19+
20+
runs:
21+
using: 'composite'
22+
steps:
23+
- name: Login to Docker Hub
24+
uses: docker/login-action@v3
25+
with:
26+
username: ${{ inputs.dockerhub_username }}
27+
password: ${{ inputs.dockerhub_token }}
28+
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
31+
32+
- name: Download image digests
33+
uses: actions/download-artifact@v4
34+
with:
35+
path: /tmp/digests
36+
pattern: ${{ inputs.digest_pattern }}
37+
merge-multiple: true
38+
39+
- name: Create manifest list and push
40+
shell: bash
41+
working-directory: /tmp/digests
42+
run: |
43+
docker buildx imagetools create \
44+
--tag ${{ inputs.registry_image }}:${{ inputs.git_commit }} \
45+
$(printf '${{ inputs.registry_image }}@sha256:%s ' *)

.github/workflows/docker.yaml

Lines changed: 14 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,6 @@ jobs:
117117
needs:
118118
- build-mina-frontend-image
119119
steps:
120-
- name: Login to Docker Hub
121-
uses: docker/login-action@v3
122-
with:
123-
username: ${{ secrets.DOCKERHUB_USERNAME }}
124-
password: ${{ secrets.DOCKERHUB_TOKEN }}
125-
126120
- name: Set up environment variables
127121
run: |
128122
if [[ "${{ github.ref }}" == "refs/heads/develop" ]]; then
@@ -134,22 +128,14 @@ jobs:
134128
echo "GIT_COMMIT=${BRANCH_NAME}" >> $GITHUB_ENV
135129
fi
136130
137-
- name: Set up Docker Buildx
138-
uses: docker/setup-buildx-action@v3
139-
140-
- name: Download mina-rust-frontend digests
141-
uses: actions/download-artifact@v4
131+
- name: Push frontend multi-arch manifest
132+
uses: ./.github/actions/push-docker-manifest
142133
with:
143-
path: /tmp/frontend-digests
144-
pattern: frontend-*-digests-*
145-
merge-multiple: true
146-
147-
- name: Create mina-rust-frontend manifest list and push
148-
working-directory: /tmp/frontend-digests
149-
run: |
150-
docker buildx imagetools create \
151-
--tag ${{ env.REGISTRY_FRONTEND_IMAGE }}:${{ env.GIT_COMMIT }} \
152-
$(printf '${{ env.REGISTRY_FRONTEND_IMAGE }}@sha256:%s ' *)
134+
registry_image: ${{ env.REGISTRY_FRONTEND_IMAGE }}
135+
git_commit: ${{ env.GIT_COMMIT }}
136+
digest_pattern: 'frontend-*-digests-*'
137+
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
138+
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
153139

154140
# Push node multi-arch manifest (after node build completes)
155141
push-node-image:
@@ -158,12 +144,6 @@ jobs:
158144
needs:
159145
- build-mina-node-image
160146
steps:
161-
- name: Login to Docker Hub
162-
uses: docker/login-action@v3
163-
with:
164-
username: ${{ secrets.DOCKERHUB_USERNAME }}
165-
password: ${{ secrets.DOCKERHUB_TOKEN }}
166-
167147
- name: Set up environment variables
168148
run: |
169149
if [[ "${{ github.ref }}" == "refs/heads/develop" ]]; then
@@ -175,19 +155,11 @@ jobs:
175155
echo "GIT_COMMIT=${BRANCH_NAME}" >> $GITHUB_ENV
176156
fi
177157
178-
- name: Set up Docker Buildx
179-
uses: docker/setup-buildx-action@v3
180-
181-
- name: Download mina-rust digests
182-
uses: actions/download-artifact@v4
158+
- name: Push node multi-arch manifest
159+
uses: ./.github/actions/push-docker-manifest
183160
with:
184-
path: /tmp/mina-digests
185-
pattern: node-digests-*
186-
merge-multiple: true
187-
188-
- name: Create mina-rust manifest list and push
189-
working-directory: /tmp/mina-digests
190-
run: |
191-
docker buildx imagetools create \
192-
--tag ${{ env.REGISTRY_NODE_IMAGE }}:${{ env.GIT_COMMIT }} \
193-
$(printf '${{ env.REGISTRY_NODE_IMAGE }}@sha256:%s ' *)
161+
registry_image: ${{ env.REGISTRY_NODE_IMAGE }}
162+
git_commit: ${{ env.GIT_COMMIT }}
163+
digest_pattern: 'node-digests-*'
164+
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
165+
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}

0 commit comments

Comments
 (0)