diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3e9e927..96b03b5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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