diff --git a/environment/infra/jenkins/build.cms.image.Jenkinsfile b/environment/infra/jenkins/build.cms.image.Jenkinsfile index 65e8ad7..1a3c093 100644 --- a/environment/infra/jenkins/build.cms.image.Jenkinsfile +++ b/environment/infra/jenkins/build.cms.image.Jenkinsfile @@ -5,29 +5,51 @@ pipeline { DOCKER_IMAGE = 'yoga-cms' DOCKER_REGISTRY = 'your-docker-registry' DOCKER_CREDENTIALS_ID = 'your-docker-credentials-id' +CURRENT_VERSION = '' } stages { stage('Checkout') { steps { - // checkout([$class: 'GitSCM', branches: [[name: '*/main']], userRemoteConfigs: [[url: 'https://gitea.rschneider.hu/rschneider/yogastic.git', credentialsId: 'rschneider_gitea.rschneider.hu']]]) - git branch: 'main', credentialsId: 'rschneider_gitea.rschneider.hu', poll: false, url: 'https://gitea.rschneider.hu/rschneider/yogastic.git' + git branch: 'main', credentialsId: 'rschneider_gitea.rschneider.hu', poll: false, url: 'https://gitea.rschneider.hu/rschneider/yogastic.git' } } + + stage('Build Docker image') { steps { sh """ cd environment/dev/docker/cms/scripts - ls -lah - pwd bash ./build.docker.build.sh """ } } + stage('Commit & Push version image') { + steps { + CURRENT_VERSION = readFile('environment/dev/docker/cms/scripts/version.txt').trim() + env.CURRENT_VERSION = CURRENT_VERSION + sh """ + cd environment/dev/docker/cms/scripts + git config user.email "jenkins@rschneider.hu" + git config user.name "Jenkins" + git add version.txt + git commit -m "[ci-skip] Update version to ${CURRENT_VERSION}" + git push + """ + } + } + + stage('Push Docker image') { + steps { + sh """ + cd environment/dev/docker/cms/scripts + bash ./build.docker.push.sh + """ + } + } } - post { always { cleanWs()