1+ name : Docker Multi-arch Manifests
2+ on :
3+ workflow_run :
4+ workflows :
5+ - " Docker Proxy AMD64"
6+ - " Docker Proxy ARM64"
7+ - " Docker Full AMD64"
8+ - " Docker Full ARM64"
9+ types : [completed]
10+
11+ jobs :
12+ check-builds :
13+ name : Check if all builds succeeded
14+ runs-on : ubuntu-latest
15+ outputs :
16+ all-success : ${{ steps.check.outputs.result }}
17+ version : ${{ steps.version.outputs.VERSION }}
18+ steps :
19+ - name : Check workflow results
20+ id : check
21+ uses : actions/github-script@v7
22+ with :
23+ script : |
24+ const workflows = [
25+ "Docker Proxy AMD64",
26+ "Docker Proxy ARM64",
27+ "Docker Full AMD64",
28+ "Docker Full ARM64"
29+ ];
30+
31+ const runId = context.payload.workflow_run.id;
32+ const ref = context.payload.workflow_run.head_sha;
33+
34+ console.log(`Checking workflows for ref: ${ref}`);
35+
36+ // Get all workflow runs for this ref
37+ const { data: runs } = await github.rest.actions.listWorkflowRunsForRepo({
38+ owner: context.repo.owner,
39+ repo: context.repo.repo,
40+ head_sha: ref,
41+ status: 'completed'
42+ });
43+
44+ const workflowResults = {};
45+
46+ for (const run of runs.workflow_runs) {
47+ if (workflows.includes(run.name)) {
48+ workflowResults[run.name] = run.conclusion;
49+ console.log(`${run.name}: ${run.conclusion}`);
50+ }
51+ }
52+
53+ // Check if all workflows succeeded
54+ const allSuccess = workflows.every(name =>
55+ workflowResults[name] === 'success'
56+ );
57+
58+ console.log(`All workflows successful: ${allSuccess}`);
59+
60+ return allSuccess;
61+
62+ - name : Extract version from workflow
63+ id : version
64+ run : |
65+ VERSION=$(echo "${{ github.event.workflow_run.head_branch }}" | sed 's/refs\/tags\///')
66+ if [[ $VERSION != v* ]]; then
67+ # If not a version tag, use the tag from the triggering release
68+ VERSION="${{ github.event.workflow_run.head_branch }}"
69+ fi
70+ echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
71+ echo "Extracted version: $VERSION"
72+
73+ create-manifests :
74+ name : Create multi-arch manifests
75+ runs-on : ubuntu-latest
76+ needs : check-builds
77+ if : needs.check-builds.outputs.all-success == 'true'
78+ permissions :
79+ contents : read
80+ packages : write
81+ steps :
82+ - name : Log in to GitHub Container Registry
83+ uses : docker/login-action@v3
84+ with :
85+ registry : ghcr.io
86+ username : ${{ github.actor }}
87+ password : ${{ secrets.GITHUB_TOKEN }}
88+
89+ - name : Create proxy multi-arch manifest
90+ run : |
91+ VERSION="${{ needs.check-builds.outputs.version }}"
92+
93+ # Create versioned proxy manifest
94+ docker manifest create ghcr.io/${{ github.repository }}:${VERSION}-proxy \
95+ ghcr.io/${{ github.repository }}:${VERSION}-proxy-amd64 \
96+ ghcr.io/${{ github.repository }}:${VERSION}-proxy-arm64
97+
98+ docker manifest push ghcr.io/${{ github.repository }}:${VERSION}-proxy
99+
100+ # Create latest proxy manifest
101+ docker manifest create ghcr.io/${{ github.repository }}:latest-proxy \
102+ ghcr.io/${{ github.repository }}:latest-proxy-amd64 \
103+ ghcr.io/${{ github.repository }}:latest-proxy-arm64
104+
105+ docker manifest push ghcr.io/${{ github.repository }}:latest-proxy
106+
107+ - name : Create full multi-arch manifest
108+ run : |
109+ VERSION="${{ needs.check-builds.outputs.version }}"
110+
111+ # Create versioned full manifest
112+ docker manifest create ghcr.io/${{ github.repository }}:${VERSION} \
113+ ghcr.io/${{ github.repository }}:${VERSION}-amd64 \
114+ ghcr.io/${{ github.repository }}:${VERSION}-arm64
115+
116+ docker manifest push ghcr.io/${{ github.repository }}:${VERSION}
117+
118+ # Create latest full manifest
119+ docker manifest create ghcr.io/${{ github.repository }}:latest \
120+ ghcr.io/${{ github.repository }}:latest-amd64 \
121+ ghcr.io/${{ github.repository }}:latest-arm64
122+
123+ docker manifest push ghcr.io/${{ github.repository }}:latest
0 commit comments