Commit 0601f156 authored by Jacek Lebioda's avatar Jacek Lebioda
Browse files

Resolve "Automatically tag and publish on version change"

parent 1f34e674
...@@ -42,22 +42,23 @@ auto-tag: ...@@ -42,22 +42,23 @@ auto-tag:
variables: variables:
VERSION_FILE: "lib/jekyll-theme-lcsb-default.rb" VERSION_FILE: "lib/jekyll-theme-lcsb-default.rb"
TARGET_BRANCH: latest TARGET_BRANCH: latest
only:
changes:
- "lib/jekyll-theme-lcsb-default.rb"
script: script:
# Make sure that it is on latest, otherwise exit # Make sure that it is on latest, otherwise exit. THIS IS A WORKAROUND, AS HAVING BOTH ONLY AND RULES IS NOT POSSIBLE
- '[[ "${CI_COMMIT_BRANCH:-1}" == "$TARGET_BRANCH" ]] && echo "On correct branch ($CI_COMMIT_BRANCH)" || exit 0' - '[[ "${CI_COMMIT_BRANCH:-1}" == "$TARGET_BRANCH" ]] && echo "On correct branch ($CI_COMMIT_BRANCH)" || exit 0'
# Make sure that the version exists # Make sure that the version exists and is correct, and put it in envvar
- VERSION=$(cat $VERSION_FILE | grep -o "\d\.\d\.\d") - cat $VERSION_FILE | grep "VERSION" | tr -d A-z\"\= | tr -d ' '
- VERSION=`cat $VERSION_FILE | grep "VERSION" | tr -d A-z\"\= | tr -d ' '`
- '[[ -z $VERSION ]] && exit -1 || echo "OK, version appears to be correct -> $VERSION"' - '[[ -z $VERSION ]] && exit -1 || echo "OK, version appears to be correct -> $VERSION"'
# Create the tag # Create the tag
- git tag -a $VERSION - git tag -a $VERSION -m $VERSION
# Publish the tag # Publish the tag
- git push origin $VERSION - git push origin $VERSION
only:
changes:
- "lib/jekyll-theme-lcsb-default.rb"
# This will push the gem to ruby-gems when the repository has been tagged # This will push the gem to ruby-gems when the repository has been tagged
release: release:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment