66 workflow_dispatch :
77 inputs :
88 dockerImageTag :
9- description : ' Image Tag '
9+ description : ' Base image version prefix (YYYYMMDD is appended automatically) '
1010 default : ' v0.9.0'
1111 required : true
1212 dockerImageTagWithLatest :
13- description : ' 是否发布latest tag(正式发版时选择,测试版本切勿选择) '
13+ description : ' Publish version, major-version and latest aliases (official releases only) '
1414 default : false
1515 required : true
1616 type : boolean
3434 - dockerhub, aliyun-registry
3535
3636jobs :
37+ prepare-tags :
38+ runs-on : ubuntu-latest
39+ outputs :
40+ image_tag : ${{ steps.tag.outputs.image_tag }}
41+ steps :
42+ - name : Generate dated base image tag
43+ id : tag
44+ env :
45+ VERSION_TAG : ${{ inputs.dockerImageTag }}
46+ run : |
47+ image_tag="$VERSION_TAG-$(TZ=Asia/Shanghai date +'%Y%m%d')"
48+ printf 'image_tag=%s\n' "$image_tag" >> "$GITHUB_OUTPUT"
49+ printf 'Base image tag: `%s`\n' "$image_tag" >> "$GITHUB_STEP_SUMMARY"
50+
3751 build-and-push-to-aliyun-registry :
52+ needs : prepare-tags
3853 if : ${{ contains(github.event.inputs.registry, 'aliyun') }}
3954 runs-on : ubuntu-latest
4055 steps :
@@ -47,13 +62,14 @@ jobs:
4762 env :
4863 DOCKER_IMAGE : ${{ secrets.ALIYUN_REGISTRY_HOST }}/dataease/sqlbot-python-pg
4964 TAG_NAME : ${{ inputs.dockerImageTag }}
65+ DATED_TAG : ${{ needs.prepare-tags.outputs.image_tag }}
5066 TAG_NAME_WITH_LATEST : ${{ inputs.dockerImageTagWithLatest }}
5167 run : |
5268 image_tags() {
5369 local image="$1"
54- local tags="$image:$TAG_NAME "
70+ local tags="$image:$DATED_TAG "
5571 if [[ "$TAG_NAME_WITH_LATEST" == 'true' ]]; then
56- tags="$tags,$image:${TAG_NAME%%.*},$image:latest"
72+ tags="$tags,$image:$TAG_NAME,$image:$ {TAG_NAME%%.*},$image:latest"
5773 fi
5874 printf '%s' "$tags"
5975 }
8197 --set 'build-base.output=type=image,push=true,oci-mediatypes=false' base build-base
8298
8399 build-and-push-to-dockerhub :
100+ needs : prepare-tags
84101 if : ${{ contains(github.event.inputs.registry, 'dockerhub') }}
85102 runs-on : ubuntu-latest
86103 steps :
@@ -93,13 +110,14 @@ jobs:
93110 env :
94111 DOCKER_IMAGE : dataease/sqlbot-python-pg
95112 TAG_NAME : ${{ inputs.dockerImageTag }}
113+ DATED_TAG : ${{ needs.prepare-tags.outputs.image_tag }}
96114 TAG_NAME_WITH_LATEST : ${{ inputs.dockerImageTagWithLatest }}
97115 run : |
98116 image_tags() {
99117 local image="$1"
100- local tags="$image:$TAG_NAME "
118+ local tags="$image:$DATED_TAG "
101119 if [[ "$TAG_NAME_WITH_LATEST" == 'true' ]]; then
102- tags="$tags,$image:${TAG_NAME%%.*},$image:latest"
120+ tags="$tags,$image:$TAG_NAME,$image:$ {TAG_NAME%%.*},$image:latest"
103121 fi
104122 printf '%s' "$tags"
105123 }
0 commit comments