Skip to content
Snippets Groups Projects
Unverified Commit 7f2d2300 authored by Timo Furrer's avatar Timo Furrer
Browse files

Check tag for semantic version early

parent b9701b41
No related branches found
No related tags found
No related merge requests found
......@@ -70,6 +70,14 @@ variables:
GITLAB_OPENTOFU_IMAGE_BASE: "$CI_REGISTRY_IMAGE/internal"
GITLAB_OPENTOFU_IMAGE_NAME: "$GITLAB_OPENTOFU_IMAGE_BASE/gitlab-opentofu:$CI_COMMIT_SHA-opentofu$OPENTOFU_VERSION"
check-semantic-version:
stage: .pre
rules:
- if: $CI_COMMIT_TAG
image: alpine:latest
script:
- echo -n "$CI_COMMIT_TAG" | ./.gitlab/scripts/check-semantic-version.sh
gitlab-opentofu-image:build:
extends: .opentofu-versions
stage: build
......@@ -223,7 +231,7 @@ create-release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG =~ /\d+/
- if: $CI_COMMIT_TAG
before_script:
- apk add --update yq envsubst
script:
......
#!/usr/bin/env sh
# Regex from https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
SEMANTIC_VERSION_REGEX='^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$'
cat - | grep -qE "$SEMANTIC_VERSION_REGEX"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment