1717 REGISTRY_IMAGE : clux/muslrust
1818
1919jobs :
20+ check-stable :
21+ name : ' Check if workflow should continue'
22+ outputs :
23+ CONTINUE_BUILD : ${{ steps.check-stable-tag.outputs.CONTINUE_BUILD }}
24+ runs-on : ' ubuntu-latest'
25+ steps :
26+ - uses : actions/checkout@v4
27+ - name : ' Check if we need a new stable'
28+ id : check-stable-tag
29+ shell : bash
30+ run : |
31+ pip3 install --user toml
32+ if python3 check_stable.py; then
33+ echo 'Stable tag missing; running all build steps'
34+ echo 'CONTINUE_BUILD=YES' >> "${GITHUB_OUTPUT}"
35+ else
36+ echo 'Stable tag found; skipping all build steps'
37+ fi
38+
2039 build :
2140 name : ' Stable Build'
41+ needs : [check-stable]
42+ if : ${{ needs.check-stable.outputs.CONTINUE_BUILD == 'YES' }}
2243 runs-on : ' ubuntu-latest'
2344 strategy :
2445 fail-fast : false
4162 username : clux
4263 password : ${{ secrets.DOCKERHUB_TOKEN }}
4364
44- - name : Check if we need a new stable
45- id : stablecheck
46- shell : bash
47- run : |
48- pip3 install --user toml
49- if python3 check_stable.py; then
50- echo "Stable tag missing; running all build steps"
51- echo "BUILD=YES" >> $GITHUB_OUTPUT
52- else
53- echo "Stable tag found; skipping all build steps"
54- fi
55-
56- - name : Prepare
57- run : |
58- platform=${{ matrix.platform }}
59- echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
60-
6165 - name : Docker meta
6266 id : meta
6367 uses : docker/metadata-action@v5
8286 tags : rustmusl-temp
8387 build-args : |
8488 CHANNEL=stable
85- if : ${{ steps.stablecheck.outputs.BUILD }}
8689
8790 - name : Run tests
88- if : ${{ steps.stablecheck.outputs.BUILD }}
8991 shell : bash
9092 run : |
9193 docker buildx build --platform ${{ matrix.platform }} --output type=docker -t test-runner - < Dockerfile.test-runner
98100 # only identifiable by their digest and it appears docker does not let us select an image that way.
99101 # Not the most elegant, but it works.
100102 - name : Store tag info
101- if : ${{ steps.stablecheck.outputs.BUILD }}
102103 shell : bash
103104 run : |
104105 mkdir -p /tmp/tags
@@ -111,7 +112,6 @@ jobs:
111112 echo $RUST_VER > /tmp/tags/rust-ver
112113
113114 - name : Tag and push
114- if : ${{ steps.stablecheck.outputs.BUILD }}
115115 shell : bash
116116 run : |
117117 RUST_DATE=$(cat /tmp/tags/rust-date)
@@ -125,15 +125,13 @@ jobs:
125125
126126 # TODO: want to do this, but need digest, which might not be trivial to get outside build-push-action
127127 # - name: Attest docker.io
128- # if: ${{ steps.stablecheck.outputs.BUILD }}
129128 # uses: actions/attest-build-provenance@v2.3.0
130129 # with:
131130 # subject-name: docker.io/${{ env.REGISTRY_IMAGE }}
132131 # subject-digest: ${{ steps.push_stable.outputs.digest }}
133132 # push-to-registry: true
134133
135134 - name : Upload tags
136- if : ${{ steps.stablecheck.outputs.BUILD }}
137135 uses : actions/upload-artifact@v4
138136 with :
139137 name : tags-${{matrix.arch}}
@@ -148,21 +146,7 @@ jobs:
148146 needs :
149147 - build
150148 steps :
151- - uses : actions/checkout@v4
152- - name : Check if we need a new stable
153- id : stablecheck
154- shell : bash
155- run : |
156- pip3 install --user toml
157- if python3 check_stable.py; then
158- echo "Stable tag missing; running all build steps"
159- echo "BUILD=YES" >> $GITHUB_OUTPUT
160- else
161- echo "Stable tag found; skipping all build steps"
162- fi
163-
164149 - name : Download tags
165- if : ${{ steps.stablecheck.outputs.BUILD }}
166150 uses : actions/download-artifact@v4
167151 with :
168152 path : /tmp/tags
@@ -185,19 +169,28 @@ jobs:
185169 password : ${{ secrets.DOCKERHUB_TOKEN }}
186170
187171 - name : Create manifest list and push multi-platform images
188- if : ${{ steps.stablecheck.outputs.BUILD }}
172+ shell : bash
189173 run : |
190174 RUST_DATE=$(cat /tmp/tags/rust-date)
191175 RUST_CHANNEL=$(cat /tmp/tags/rust-channel)
192176 RUST_VER=$(cat /tmp/tags/rust-ver)
193177
194- for tag in ${RUST_CHANNEL} ${RUST_CHANNEL}-${RUST_DATE} ${RUST_VER}-${RUST_CHANNEL} ${RUST_VER}-${RUST_CHANNEL}-${RUST_DATE}; do
195- docker buildx imagetools create -t ${{ env.REGISTRY_IMAGE }}:$tag \
196- ${{ env.REGISTRY_IMAGE }}:amd64-${RUST_VER}-${RUST_CHANNEL}-${RUST_DATE} \
197- ${{ env.REGISTRY_IMAGE }}:arm64-${RUST_VER}-${RUST_CHANNEL}-${RUST_DATE}
198- done
178+ # The two already published image tags to associate additional tags to:
179+ AMD64="${{ env.REGISTRY_IMAGE }}:amd64-${RUST_VER}-${RUST_CHANNEL}-${RUST_DATE}"
180+ ARM64="${{ env.REGISTRY_IMAGE }}:arm64-${RUST_VER}-${RUST_CHANNEL}-${RUST_DATE}"
181+
182+ EXTRA_TAGS=(
183+ "${RUST_CHANNEL}"
184+ "${RUST_CHANNEL}-${RUST_DATE}"
185+ "${RUST_VER}-${RUST_CHANNEL}"
186+ "${RUST_VER}-${RUST_CHANNEL}-${RUST_DATE}"
187+ )
188+
189+ # Assign each tag to the two source image tags:
190+ for TAG in "${EXTRA_TAGS[@]}"; do
191+ docker buildx imagetools create --tag "${{ env.REGISTRY_IMAGE }}:${TAG}" "${AMD64}" "${ARM64}"
192+ done
199193
200194 - name : Inspect image
201- if : ${{ steps.stablecheck.outputs.BUILD }}
202195 run : |
203196 docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:latest
0 commit comments