4 Step of the process:
- Commit Code:
git commit -m "Some meaningful message" - Create tag
- To enter the stage:
git tag -a release_stage_<meaningful tag> - To free a file:
git tag -a release_production_<meaningful tag>
- Push Tag Click Tag:
git push origin release_stage_<same_meaningful_tag> - Push commit
git push origin <branch_name>
Jenkins File:
stage('Checkout Project')
properties([pipelineTriggers([[$class: 'GitHubPushTrigger']])])
checkout scm
git_branch = env.BRANCH_NAME
git_branch_to_release = env.BRANCH_NAME
git_tag = sh returnStdout: true, script: 'git tag -l --points-at HEAD'
//And now you can use to do anything with tags
`` ``
if(currentBuild.result=='SUCCESSFUL' || currentBuild.result=='SUCCESS' || currentBuild.result == null)
{
if (git_tag.contains('release_stage') || git_tag.contains('release_production'))
{
// Do anything which you want to do with tags
}
}
`` ``
source
share