Update .gitlab-ci.yml file -- releases only for master and for valid tag format

This commit is contained in:
ansgarz 2021-11-26 19:33:11 +00:00
parent 1ea82db32e
commit abb93ebb13

View file

@ -71,10 +71,13 @@ publish:
fatjar: fatjar:
stage: fatjar stage: fatjar
rules: rules:
- if: $CI_COMMIT_TAG # Do no allow manually triggered pipelines to prevent duplicates!
only: # Instead rerun the pipeline created with the last push
refs: - if: $CI_PIPELINE_SOURCE != "push"
- master when: never
# Only execute when a valid version tag like v1.0, 2.3 or similar is given
# Required is always one point like 1.0
- if: $CI_COMMIT_REF_NAME == "master" && $CI_COMMIT_TAG =~ /^v?[0-9]+[.][0-9]+([.][0-9]+)?$/
before_script: before_script:
- echo $CI_JOB_ID - echo $CI_JOB_ID
# Writing FATJAR_JOB_ID variable to environment file, as variable is needed in the release stage. # Writing FATJAR_JOB_ID variable to environment file, as variable is needed in the release stage.
@ -94,10 +97,13 @@ fatjar:
release: release:
stage: release stage: release
rules: rules:
- if: $CI_COMMIT_TAG # Run this job when a git tag is created manually # Do no allow manually triggered pipelines to prevent duplicates!
only: # Instead rerun the pipeline created with the last push
refs: - if: $CI_PIPELINE_SOURCE != "push"
- master when: never
# Only execute when a valid version tag like v1.0, 2.3 or similar is given
# Required is always one point like 1.0
- if: $CI_COMMIT_REF_NAME == "master" && $CI_COMMIT_TAG =~ /^v?[0-9]+[.][0-9]+([.][0-9]+)?$/
needs: needs:
- job: fatjar - job: fatjar
artifacts: true artifacts: true