go-hello-world2/Jenkinsfile
2024-03-31 15:38:44 +03:30

59 lines
1.1 KiB
Groovy

pipeline {
agent {
docker { image 'rbehzadan/golang_goreleaser:1.22.1-1.24.0' }
}
environment {
GITEA_TOKEN = credentials('git.behzadan.ir')
NOTIFY_TOKEN = credentials('notify_events_sinic_alert')
}
stages {
stage('Test') {
steps {
sh 'make test'
}
}
stage('Release') {
steps {
sh 'git config --global user.email "rbehzadan@gmail.com"'
sh 'git config --global user.name "Reza Behzadan"'
sh 'git tag -a v$(cat VERSION) -m "v$(cat VERSION)"'
sh 'goreleaser release'
}
}
stage('Cleanup') {
steps {
sh 'make clean'
}
}
}
post {
success {
echo 'Build succeeded!'
notifyEvents title: 'jenkins.home.behzadan.ir/$JOB_NAME/$BUILD_ID',
message: 'Build succeeded!',
token: "${env.NOTIFY_TOKEN}"
}
failure {
echo 'Build failed!'
notifyEvents title: 'jenkins.home.behzadan.ir/$JOB_NAME/$BUILD_ID',
message: 'Build failed!',
token: "${env.NOTIFY_TOKEN}"
}
}
}