File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed
Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Tag new images version
2+ on :
3+ schedule :
4+ # Quarterly schedule, roughly aligned with JDK CPU
5+ - cron : ' 0 0 30 1,4,7,10 *'
6+ workflow_dispatch :
7+
8+ jobs :
9+ tag-images :
10+ name : Tag new images version
11+ runs-on : ubuntu-latest
12+ permissions :
13+ contents : read
14+ packages : write
15+ steps :
16+ - name : Checkout repository
17+ uses : actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # 3.3.0
18+ - name : Login to ghcr.io
19+ uses : docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # 2.1.0
20+ with :
21+ registry : ghcr.io
22+ username : ${{ github.actor }}
23+ password : ${{ secrets.GITHUB_TOKEN }}
24+ - name : Tag images
25+ run : ./build --tag
Original file line number Diff line number Diff line change @@ -203,6 +203,26 @@ function do_push() {
203203 done
204204}
205205
206+ function do_tag() {
207+ local tag token version
208+ TAG_PREFIX=
209+ echo " Pulling latest images"
210+ for tag in base latest " ${BASE_VARIANTS[@]} " " ${VARIANTS[@]} " ; do
211+ tag=" ${tag,,} "
212+ tag=" $( image_name " ${tag} " ) "
213+ docker pull " $tag "
214+ done
215+ version=" $( date +%y.%m) "
216+ echo " Tagging version $version "
217+ for tag in base latest " ${BASE_VARIANTS[@]} " " ${VARIANTS[@]} " ; do
218+ tag=" ${tag,,} "
219+ tag=" $( image_name " ${tag} " ) "
220+ new_tag=" ${tag/:/: v$version -} "
221+ docker tag " $tag " " $new_tag "
222+ docker push " $new_tag "
223+ done
224+ }
225+
206226if [[ -z ${1:- } ]]; then
207227 do_build
208228elif [[ ${1} = " --test" ]]; then
@@ -216,4 +236,6 @@ elif [[ ${1} = "--inner-describe" ]]; then
216236 do_inner_describe
217237elif [[ ${1} = " --push" ]]; then
218238 do_push
239+ elif [[ ${1} = " --tag" ]]; then
240+ do_tag
219241fi
You can’t perform that action at this time.
0 commit comments