From 41ae7155ce85d02b4a1b6ce21fdd73661c0af1d3 Mon Sep 17 00:00:00 2001
From: Jacek Lebioda <jacek.lebioda@uni.lu>
Date: Thu, 2 Aug 2018 11:32:47 +0200
Subject: [PATCH] Automatic building and publishing ruby gems on tagged commit
 works. resolves #18

---
 .gitlab-ci.yml | 6 ++----
 README.md      | 4 ++++
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index fd0d913..1d26fd0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -5,7 +5,6 @@ variables:
 
 stages:
   - test
-  - pages
   - deploy
   - release
 
@@ -35,8 +34,7 @@ pages:
 release:
   stage: release
   script:
-    - echo "$API_KEY_B64" | base64 --decode > ~/.gem/credentials && chmod 0600 ~/.gem/credentials
-    - gem build jekyll-theme-lcsb-default.gemspec
-    - gem push jekyll-theme-lcsb-default*.gem
+    - 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
   only:
     - tags
diff --git a/README.md b/README.md
index 2d455f4..60483f6 100644
--- a/README.md
+++ b/README.md
@@ -125,6 +125,10 @@ Your theme is setup just like a normal Jekyll site! To test your theme, run `bun
 When your theme is released, only the files in `_layouts`, `_includes`, `_sass` and `assets` tracked with Git will be bundled.
 To add a custom directory to your theme-gem, please edit the regexp in `jekyll-theme-lcsb-default.gemspec` accordingly.
 
+## Automatic gem publishing
+Gitlab CI is configured to automatically build and publish a new version of theme, whenever the commit is tagged.
+For details refer to [the documentation of ruby gems](https://guides.rubygems.org/make-your-own-gem/), and this repository's `.gitlab-ci.yml` and settings.
+
 ## License
 
 The theme is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
-- 
GitLab