4747 echo $trim
4848 echo "VERSION=${trim}" >> $GITHUB_ENV
4949
50- - name : Validate Version String is SemVer
50+ - name : Validate Version String (only accept prod & rc)
5151 run : |-
52- if [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
52+ if [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)? $ ]]; then
5353 echo "Version OK: $VERSION"
5454 else
5555 echo "Invalid version: $VERSION"
@@ -142,6 +142,7 @@ jobs:
142142 - name : Push to the container registry
143143 run : |-
144144 REF="$CR/$CR_PREFIX/$ORG/$PLUGIN_NAME:$VERSION"
145+ LATEST_REF="$CR/$CR_PREFIX/$ORG/$PLUGIN_NAME:latest"
145146 oras push $REF \
146147 --config config.json:application/vnd.turbot.steampipe.config.v1+json \
147148 --annotation-file annotations.json \
@@ -151,5 +152,15 @@ jobs:
151152 steampipe-plugin-${PLUGIN_NAME}_linux_arm64.gz:application/vnd.turbot.steampipe.plugin.linux-arm64.layer.v1+gzip \
152153 docs:application/vnd.turbot.steampipe.plugin.docs.layer.v1+tar \
153154 config:application/vnd.turbot.steampipe.plugin.spc.layer.v1+tar
155+
156+ # tag the image with the GitHub Run ID for traceability
154157 oras tag $REF $GITHUB_RUN_ID
158+
159+ # check if the version is NOT an rc version before tagging as latest
160+ if [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
161+ echo "Tagging as latest: $LATEST_REF"
162+ oras tag $REF $LATEST_REF
163+ else
164+ echo "Skipping latest tag for rc version: $VERSION"
165+ fi
155166
0 commit comments