Commit 03862353 authored by Jacek Lebioda's avatar Jacek Lebioda
Browse files

feat: tag automatically when version changes

parent 4d1ee0a7
......@@ -36,13 +36,32 @@ pages:
paths:
- public
# This will push the gem to ruby-gems when tagged
# This will tag the repository when the version-file changes and the theme successfully builds
tag:
stage: deploy
variables:
VERSION_FILE: "lib/jekyll-theme-lcsb-default.rb"
script:
# Make sure that the version exists
- VERSION=$(cat $VERSION_FILE | grep -o "\d\.\d\.\d")
- '[[ -z $VERSION ]] && exit -1 || echo "OK, version appears to be correct -> $VERSION"'
# Create the tag
- git tag -a $VERSION
# Publish the tag
- 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
release:
stage: release
script:
- mkdir -p ~/.gem && echo "$API_KEY_BASE64" | base64 --decode > ~/.gem/credentials && chmod 0600 ~/.gem/credentials
- gem build jekyll-theme-lcsb-default.gemspec && gem push jekyll-theme-lcsb-default*.gem
rules:
# Run only on master...
# Run only when there is a new tag
- if: $CI_COMMIT_TAG
# frozen_string_literal: true
# Load version
require File.expand_path("lib/jekyll-theme-lcsb-default", __dir__)
Gem::Specification.new do |spec|
spec.name = "jekyll-theme-lcsb-default"
spec.version = "0.3.16"
spec.version = Theme::VERSION
spec.authors = ["Trefex", "jaceklebioda_lux"]
spec.email = ["lcsb-sysadmins@uni.lu"]
......@@ -10,7 +13,7 @@ Gem::Specification.new do |spec|
spec.homepage = "https://git-r3lab.uni.lu/core-services/jekyll-theme-lcsb-default"
spec.license = "MIT"
spec.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r!^(assets|_layouts|_includes|_sass|LICENSE|README)!i) }
spec.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r!^(assets|_layouts|lib|_includes|_sass|LICENSE|README)!i) }
spec.add_runtime_dependency "jekyll", "~> 4.0"
spec.add_runtime_dependency "jekyll-seo-tag", "~> 2.5"
......
# frozen_string_literal: true
# Note: remember to keep it in the format of NUMBER.NUMBER.NUMBER (where NUMBER is [0-9]+) - otherwise gitlab-ci could fail to detect the version
module Theme
VERSION = "0.3.17"
end
\ No newline at end of file
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