I am releasing the artifact to the Artifact registry in the Google cloud. I want to have a semantic versioning release cycle using the git annotation tag to the master branch.
steps:
# This step show the version of Gradle
- id: Gradle Install
name: gradle:7.4.2-jdk17-alpine
entrypoint: gradle
args: ["--version"]
# This step build the gradle application
- id: Build
name: gradle:7.4.2-jdk17-alpine
entrypoint: gradle
args: ["assemble"]
- id: Publish
name: gradle:7.4.2-jdk17-alpine
entrypoint: "sh"
args:
- -c
- |
if [ $BRANCH_NAME == 'master' ]
then
echo "Branch is = $BRANCH_NAME"
gradle publish
fi
In the last publish step, I want to write a condition for finding the latest git tag for versioning like 1.0.0, and should run that step on only when that condition matched. Similar to the other auto tools
Now on TRAVIS CI/CD
skip_cleanup: true
on:
all_branches: false
branch: master
tag: true
condition: "$TRAVIS_TAG = ~^v\d+\.\d+\.\d+$"
What is the equivalent of the above semantic versioning release in GCP. How to write the regular expression condition on google cloud build
Cloud Build doesn't have semantic versioning as it doesn't include a sequential build number that increments depending on the number of commits. Substituting variable values would be the nearest equivalent for semantic versioning as there is an option for users have the option to define their own substitutions.
Here's a sample
yaml
file for user-defined substitution:You can check the links below for additional information on
substitutions
for Cloud Build:Let me know if you have questions or clarifications.