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:
stage: fatjar
rules:
- if: $CI_COMMIT_TAG
only:
refs:
- master
# Do no allow manually triggered pipelines to prevent duplicates!
# Instead rerun the pipeline created with the last push
- if: $CI_PIPELINE_SOURCE != "push"
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:
- echo $CI_JOB_ID
# Writing FATJAR_JOB_ID variable to environment file, as variable is needed in the release stage.
@ -94,10 +97,13 @@ fatjar:
release:
stage: release
rules:
- if: $CI_COMMIT_TAG # Run this job when a git tag is created manually
only:
refs:
- master
# Do no allow manually triggered pipelines to prevent duplicates!
# Instead rerun the pipeline created with the last push
- if: $CI_PIPELINE_SOURCE != "push"
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:
- job: fatjar
artifacts: true