17
17
REGISTRY_IMAGE : clux/muslrust
18
18
19
19
jobs :
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
+
20
39
build :
21
40
name : ' Stable Build'
41
+ needs : [check-stable]
42
+ if : ${{ needs.check-stable.outputs.CONTINUE_BUILD == 'YES' }}
22
43
runs-on : ' ubuntu-latest'
23
44
strategy :
24
45
fail-fast : false
41
62
username : clux
42
63
password : ${{ secrets.DOCKERHUB_TOKEN }}
43
64
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
-
61
65
- name : Docker meta
62
66
id : meta
63
67
uses : docker/metadata-action@v5
82
86
tags : rustmusl-temp
83
87
build-args : |
84
88
CHANNEL=stable
85
- if : ${{ steps.stablecheck.outputs.BUILD }}
86
89
87
90
- name : Run tests
88
- if : ${{ steps.stablecheck.outputs.BUILD }}
89
91
shell : bash
90
92
run : |
91
93
docker buildx build --platform ${{ matrix.platform }} --output type=docker -t test-runner - < Dockerfile.test-runner
98
100
# only identifiable by their digest and it appears docker does not let us select an image that way.
99
101
# Not the most elegant, but it works.
100
102
- name : Store tag info
101
- if : ${{ steps.stablecheck.outputs.BUILD }}
102
103
shell : bash
103
104
run : |
104
105
mkdir -p /tmp/tags
@@ -111,7 +112,6 @@ jobs:
111
112
echo $RUST_VER > /tmp/tags/rust-ver
112
113
113
114
- name : Tag and push
114
- if : ${{ steps.stablecheck.outputs.BUILD }}
115
115
shell : bash
116
116
run : |
117
117
RUST_DATE=$(cat /tmp/tags/rust-date)
@@ -125,15 +125,13 @@ jobs:
125
125
126
126
# TODO: want to do this, but need digest, which might not be trivial to get outside build-push-action
127
127
# - name: Attest docker.io
128
- # if: ${{ steps.stablecheck.outputs.BUILD }}
129
128
130
129
# with:
131
130
# subject-name: docker.io/${{ env.REGISTRY_IMAGE }}
132
131
# subject-digest: ${{ steps.push_stable.outputs.digest }}
133
132
# push-to-registry: true
134
133
135
134
- name : Upload tags
136
- if : ${{ steps.stablecheck.outputs.BUILD }}
137
135
uses : actions/upload-artifact@v4
138
136
with :
139
137
name : tags-${{matrix.arch}}
@@ -148,21 +146,7 @@ jobs:
148
146
needs :
149
147
- build
150
148
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
-
164
149
- name : Download tags
165
- if : ${{ steps.stablecheck.outputs.BUILD }}
166
150
uses : actions/download-artifact@v4
167
151
with :
168
152
path : /tmp/tags
@@ -185,19 +169,28 @@ jobs:
185
169
password : ${{ secrets.DOCKERHUB_TOKEN }}
186
170
187
171
- name : Create manifest list and push multi-platform images
188
- if : ${{ steps.stablecheck.outputs.BUILD }}
172
+ shell : bash
189
173
run : |
190
174
RUST_DATE=$(cat /tmp/tags/rust-date)
191
175
RUST_CHANNEL=$(cat /tmp/tags/rust-channel)
192
176
RUST_VER=$(cat /tmp/tags/rust-ver)
193
177
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
199
193
200
194
- name : Inspect image
201
- if : ${{ steps.stablecheck.outputs.BUILD }}
202
195
run : |
203
196
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:latest
0 commit comments