Skip to content

Commit

Permalink
Add date to container image tag only if Maven version contains SNAPSHOT
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardehrenfried committed Sep 13, 2023
1 parent e57db69 commit 5c08a00
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/cibuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,14 @@ jobs:
version_with_snapshot=`mvn -q help:evaluate -Dexpression=project.version -q -DforceStdout`
version=${version_with_snapshot/-SNAPSHOT/}
image_date=`date +%Y-%m-%dT%H-%M`
image_version="${version}_${image_date}"
image_version=${version}
## if the Maven version contains SNAPSHOT, then add date to tag
if [[ $version_with_snapshot == *"SNAPSHOT"* ]]; then
image_date=`date +%Y-%m-%dT%H-%M`
image_version="${version}_${image_date}"
echo "Maven version ${version_with_snapshot} contains SNAPSHOT, adding date to container image tag"
fi
mvn --batch-mode -P prettierSkip compile com.google.cloud.tools:jib-maven-plugin:build -Djib.to.tags=latest,$image_version

0 comments on commit 5c08a00

Please sign in to comment.