@@ -189,7 +189,8 @@ jobs:
189189 echo '${{ steps.image_env.outputs.IMAGE_BUILDROOT_TAG }}@'"$IMAGE_BUILDROOT_DIGEST" | tee -a ${{ steps.image_env.outputs.IMAGE_HOME }}/manifest.txt
190190 ls ${{ steps.image_env.outputs.IMAGE_HOME }}
191191
192- - name : upload build
192+ -
193+ name : upload build
193194 uses : actions/upload-artifact@v4
194195 with :
195196 if-no-files-found : error
@@ -199,7 +200,8 @@ jobs:
199200 ${{ steps.image_env.outputs.IMAGE_HOME }}/image-${{ steps.image_env.outputs.IMAGE_TAG_SAFE }}.tar
200201 ${{ steps.image_env.outputs.IMAGE_HOME }}/image-${{ steps.image_env.outputs.IMAGE_BUILDROOT_TAG_SAFE }}.tar
201202
202- - name : upload build info
203+ -
204+ name : upload build info
203205 uses : actions/upload-artifact@v4
204206 with :
205207 if-no-files-found : error
@@ -208,61 +210,98 @@ jobs:
208210 path : |
209211 ${{ steps.image_env.outputs.IMAGE_HOME }}/*.txt
210212
211- update-dockerhub-desc :
213+ upload :
212214 name : " Upload and update metadata"
213215 needs : [build_images]
214- runs-on : " ubuntu-latest"
216+
217+ strategy :
218+ fail-fast : true
219+ matrix :
220+ registry :
221+ - docker.io
222+ - ghcr.io
223+ python :
224+ - ' 3.14'
225+ - ' 3.13'
226+ - ' 3.12'
227+ - ' 3.11'
228+ - ' 3.10'
229+ - ' 3.9'
230+ - ' 3.8'
231+ alpine :
232+ - ' 3.20'
233+ - ' 3.21'
234+ - ' 3.22'
235+ os :
236+ - ' ubuntu-latest'
237+ exclude :
238+ # No tag
239+ - python : ' 3.8'
240+ alpine : ' 3.21'
241+ - python : ' 3.8'
242+ alpine : ' 3.22'
243+ - python : ' 3.14'
244+ alpine : ' 3.20'
215245
216246 permissions :
217247 packages : write
218248
249+ runs-on : ${{ matrix.os }}
219250 steps :
220251 -
221252 name : Checkout
222253 uses : actions/checkout@v4
223- - uses : actions/setup-python@v6
254+ -
255+ uses : actions/setup-python@v6
224256 with :
225257 python-version : ' 3.12'
226258 -
227259 name : install dependencies
228260 run : |
229261 sudo apt-get -y install skopeo
230- python -m pip install jinplate
231-
232-
233262 -
234263 name : fetch images
235264 uses : actions/download-artifact@v5
236265 with :
237- pattern : images-*
238- path : dist-images
266+ name : images-alpine${{ matrix.alpine }}-python${{ matrix.python }}
239267 merge-multiple : true
240-
268+ path : dist-images/
241269 -
242- name : prep files
270+ name : Rename files
243271 run : |
244- printf " Images:\n\n" >> "$GITHUB_STEP_SUMMARY"
272+ printf ' Images:\n\n' >> "$GITHUB_STEP_SUMMARY"
245273 for filename in $(find dist-images -type f -name "*.tar" -print)
246274 do
247275 image_uri="$(basename -s .tar $filename | sed 's/image-//g' | base64 -d)"
248- for repository in docker.io ghcr.io
249- do
250- new_image_uri=$(echo $image_uri | sed 's|localhost:5000|'"$repository"'|g')
251- new_filename="dist-images/image-$(echo $new_image_uri | base64 -w 0).tar"
252- cp ${filename} ${new_filename}
253- echo '* `'${new_filename}'` (`'${new_image_uri}'`)' >> "$GITHUB_STEP_SUMMARY"
254- done
276+ new_image_uri=$(echo $image_uri | sed 's|localhost:5000|${{ matrix.repository }}|g')
277+ new_filename="dist-images/image-$(echo $new_image_uri | base64 -w 0).tar"
278+ cp ${filename} ${new_filename}
279+ printf '* `'${new_filename}'` (`'${new_image_uri}'`)\n' >> "$GITHUB_STEP_SUMMARY"
255280 rm $filename
256281 done
282+ printf '\n' >> "GITHUB_STEP_SUMMARY"
257283
258- - name : login to registry
284+ - name : login to dockerhub
285+ if : ${{ matrix.repository == 'docker.io' }}
259286 env :
260287 DOCKERHUB_TOKEN : ${{ secrets.DOCKERHUB_TOKEN }}
261- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
262288 run : |
263- printf "${GITHUB_TOKEN}\n" | skopeo login --password-stdin --username ${{ github.repository_owner }} ghcr.io
264- printf "${DOCKERHUB_TOKEN}\n" | skopeo login --password-stdin --username ${{ github.repository_owner }} docker.io
289+ printf "${DOCKERHUB_TOKEN}\n" | skopeo \
290+ login \
291+ --password-stdin \
292+ --username ${{ github.repository_owner }} \
293+ '${{ matrix.registry }}'
265294
295+ - name : login to ghcr
296+ if : ${{ matrix.repository == 'ghcr.io' }}
297+ env :
298+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
299+ run : |
300+ printf "${GITHUB_TOKEN}\n" | skopeo \
301+ login \
302+ --password-stdin \
303+ --username ${{ github.repository_owner }} \
304+ '${{ matrix.registry }}'
266305 -
267306 name : upload to registry
268307 run : |
@@ -340,14 +379,13 @@ jobs:
340379 $url)"
341380 local version_id=$(echo "${versions_json}" | jq -r --arg tag "$tag" '.[] | select(.metadata.container.tags[] == $tag) | .id')
342381 local package_url="https://github.com/${repo_name}/pkgs/container/${package_name}/${version_id}?tag=${tag}"
343- if ! [ x$output = x -o x$output = x- ]; then
382+ if ! [ x$output = x -o x$output = x- -o x$output = x/dev/stdout ]; then
344383 >>"$output" echo "${image_tag}@${package_url}"
345384 else
346385 echo "${image_tag}@${package_url}"
347386 fi
348387 }
349388
350- printf '#Upload to registry\n\n' >> "$GITHUB_STEP_SUMMARY"
351389 num_outstanding=0
352390 concurrency_limit=8
353391 for filename in $(find dist-images -type f -name "*.tar" -print)
@@ -362,26 +400,12 @@ jobs:
362400 done
363401 wait
364402 echo 'Done uploading'
365-
366-
367- -
368- name : aggregate metadata
369- run : |
370403 {
371- printf '### manifest.txt\n\n'
372- printf '```\n'
404+ printf '# Uploaded\n\n```'
373405 cat manifest.txt
374- printf '```\n'
375- } >>"$GITHUB_STEP_SUMMARY"
376- {
377- printf '### packages.txt\n\n'
378- printf '```\n'
379- cat packages.txt
380- printf '```\n'
406+ print '```\n\n'
381407 } >>"$GITHUB_STEP_SUMMARY"
382- -
383- name : parse metadata for README
384- run : |
408+
385409 for filename in $(echo dist-images/image-*.tar)
386410 do
387411 IMAGE_URI="$(basename -s .tar $filename | sed 's/image-//g' | base64 -d)"
@@ -401,37 +425,91 @@ jobs:
401425 "package_url": "'$PACKAGE_URL'"
402426 }'
403427 done | >./values.json jq -s '. | {"images": .}'
404- cat ./values.json
428+
429+ -
430+ name : Upload metadata
431+ uses : actions/upload-artifact@v4
432+ with :
433+ if-no-files-found : error
434+ retention-days : 1
435+ name : upload-alpine${{ matrix.alpine }}-python${{ matrix.python }}-metadata
436+ path : |
437+ manifest.txt
438+ packages.txt
439+ values.json
440+
441+ post-upload :
442+ name : " Post Upload"
443+ needs : [upload]
444+ runs-on : " ubuntu-latest"
445+
446+ steps :
447+ -
448+ name : Checkout
449+ uses : actions/checkout@v4
450+ -
451+ name : " Setup Python"
452+ uses : actions/setup-python@v6
453+ with :
454+ python-version : ' 3.12'
455+ -
456+ name : install dependencies
457+ run : |
458+ python -m pip install jinplate
459+ -
460+ name : Fetch build metadata
461+ uses : actions/download-artifact@v5
462+ with :
463+ pattern : upload-*-metadata
464+ path : dist-images/
465+ merge-multiple : false
466+ -
467+ name : parse metadata for README
468+ run : |
469+ >./manifest.txt cat $(find ./dist-images -type f -name 'manifest.txt' -print)
470+ >./packages.txt cat $(find ./dist-images -type f -name 'packages.txt' -print)
471+ {
472+ printf '# manifest_file.txt\n\n```'
473+ cat ./manifest.txt
474+ printf '```\n\n'
475+ printf '# packages.txt\n\n```'
476+ cat ./packages.txt
477+ printf '```\n\n'
478+ printf '# values.json\n\n```'
479+ cat \
480+ $(find ./dist-images -type f -name 'values.json' -print) | \
481+ jq -r --slurp '[.[]] | flatten' | tee ./values.json
482+ printf '```\n\n'
483+ } | tee -a "$GITHUB_STEP_SUMMARY"
484+ find ./dist-images \
485+ -type \( -name manifest.txt -o -name packages.txt -o -name values.json \) \
486+ -delete
405487 >./README.rst python \
406488 -m jinplate.cli \
407- README.rst.tmpl file://$PWD/values.json
489+ docs/README.rst.tmpl file://$PWD/values.json
490+ {
491+ printf "# README.rst\n\n```"
492+ cat README.rst
493+ printf "```\n\n"
494+ } | tee -a "$GITHUB_STEP_SUMMARY"
408495 -
409- name : Convert README.rst to markdown
496+ name : " Convert README.rst to markdown"
410497 uses : docker://pandoc/core:3.8
411498 with :
412499 args : >-
413- -s
414500 --wrap=none
415501 -t gfm
416502 -o README.md
417503 README.rst
418504 -
419- name : Print out markdown
505+ name : " Print out markdown"
420506 run : |
421- cat README.md >>"$GITHUB_STEP_SUMMARY"
422-
423- - name : upload build info
424- uses : actions/upload-artifact@v4
425- with :
426- if-no-files-found : error
427- retention-days : 1
428- name : readmes
429- path : |
430- README.rst
431- README.md
432-
507+ {
508+ printf '# README.md\n\n'
509+ cat README.md
510+ } | tee -a "$GITHUB_STEP_SUMMARY"
433511 -
434- name : Update repo description
512+ name : Update Dockerhub description
435513 uses : peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae # v4.0.0
436514 with :
437515 username : ${{ github.repository_owner }}
0 commit comments