@@ -3,20 +3,31 @@ name: Build and Push Development Docker Images
33on :
44 push :
55 branches : [ "main" ]
6+
7+ concurrency :
8+ group : docker
9+
610jobs :
711 build-and-push :
8- runs-on : ubuntu-latest
12+ runs-on : ${{ matrix.runner }}
913 timeout-minutes : 30
10- concurrency :
11- group : docker
14+
15+ strategy :
16+ fail-fast : false
17+ matrix :
18+ include :
19+ - arch : amd64
20+ runner : ubuntu-24.04
21+ - arch : arm64
22+ runner : ubuntu-24.04-arm
1223
1324 permissions :
1425 contents : read
1526 packages : write
1627
1728 steps :
1829 - name : Checkout code
19- uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
30+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2031 with :
2132 persist-credentials : false
2233
@@ -34,15 +45,75 @@ jobs:
3445 run : |
3546 echo "REPO_LC=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
3647
37- - name : Build and push Docker image
48+ - name : Compute version string
49+ run : |
50+ SHA12="${GITHUB_SHA:0:12}"
51+ BRANCH="${GITHUB_REF_NAME}"
52+ if [ -z "${BRANCH}" ]; then
53+ VERSION="dev"
54+ else
55+ VERSION="dev/${BRANCH}@${SHA12}"
56+ fi
57+ echo "VERSION=${VERSION}" >> $GITHUB_ENV
58+
59+ - name : Build and push Docker image (single arch)
3860 uses : docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
3961 with :
4062 context : .
4163 push : true
42- platforms : linux/amd64,linux/arm64
43- tags : ghcr.io/${{ env.REPO_LC }}-snapshot:dev
64+ platforms : linux/${{ matrix.arch }}
65+ tags : ghcr.io/${{ env.REPO_LC }}-snapshot:dev-${{ matrix.arch }}
66+ build-args : |
67+ VERSION=${{ env.VERSION }}
68+
69+ manifest :
70+ needs : build-and-push
71+ runs-on : ubuntu-24.04
72+ timeout-minutes : 10
73+
74+ permissions :
75+ contents : read
76+ packages : write
77+
78+ steps :
79+ - name : Set up Docker Buildx
80+ uses : docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
81+
82+ - name : Login to GitHub Container Registry
83+ uses : docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
84+ with :
85+ registry : ghcr.io
86+ username : ${{ github.actor }}
87+ password : ${{ secrets.GITHUB_TOKEN }}
4488
89+ - name : Set lowercase repository name
90+ run : |
91+ echo "REPO_LC=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
92+
93+ - name : Create and push multi-arch manifest tag
94+ shell : bash
95+ run : |
96+ IMAGE="ghcr.io/${REPO_LC}-snapshot"
97+
98+ docker buildx imagetools create \
99+ -t "${IMAGE}:dev" \
100+ "${IMAGE}:dev-amd64" \
101+ "${IMAGE}:dev-arm64"
102+
103+ docker buildx imagetools inspect "${IMAGE}:dev"
104+
105+ cleanup :
106+ needs : manifest
107+ runs-on : ubuntu-latest
108+ timeout-minutes : 10
109+
110+ permissions :
111+ contents : read
112+ packages : write
113+
114+ steps :
45115 - name : Set lowercase package name
116+ shell : bash
46117 run : |
47118 PACKAGE_NAME=${GITHUB_REPOSITORY##*/}
48119 echo "PACKAGE_NAME_LC=${PACKAGE_NAME,,}" >> $GITHUB_ENV
@@ -55,3 +126,26 @@ jobs:
55126 package-type : container
56127 min-versions-to-keep : 10
57128 delete-only-untagged-versions : ' true'
129+
130+ trigger-rollout :
131+ needs : manifest
132+ runs-on : arc-runner-set
133+ timeout-minutes : 10
134+
135+ permissions :
136+ id-token : write
137+ contents : read
138+
139+ steps :
140+ - name : Set lowercase repository name
141+ shell : bash
142+ run : |
143+ echo "REPO_LC=${GITHUB_REPOSITORY,,}" >> "$GITHUB_ENV"
144+
145+ - name : Trigger rollout
146+ uses : unitvectory-labs/kuberollouttrigger-action@e95cb8eb9a669a16363c13734a3663a7bcca54f2 # v0.2.0
147+ with :
148+ audience : ${{ secrets.KUBEROLLOUTTRIGGER_AUD }}
149+ url : ${{ secrets.KUBEROLLOUTTRIGGER_URL }}
150+ image : ghcr.io/${{ env.REPO_LC }}-snapshot
151+ tags : dev,dev-amd64,dev-arm64
0 commit comments