From 013f0dec6a1d03484828a34b40fcfb0a4a233425 Mon Sep 17 00:00:00 2001
From: librelois <elois@ifee.fr>
Date: Sun, 22 Apr 2018 18:55:11 +0200
Subject: [PATCH] [enh] #64 add job to publish crates

---
 .gitlab-ci.yml    | 14 +++++++++++++-
 gitlab/publish.sh |  6 ++++++
 2 files changed, 19 insertions(+), 1 deletion(-)
 create mode 100644 gitlab/publish.sh

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 96e9fa12..8452653d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,6 +2,7 @@ stages:
     - build_and_tests
     - clippy
     - fmt
+    - publish
     
 before_script:
     - export PATH="$HOME/.cargo/bin:$PATH"
@@ -55,4 +56,15 @@ fmt:
     - cargo install --force rustfmt-nightly
   script:
     - cargo fmt -- --write-mode=diff
-  allow_failure: true
\ No newline at end of file
+  allow_failure: true
+
+publish:
+  stage: publish
+  tags:
+    - redshift-rs-stable
+  script:
+    - ./gitlab/publish.sh
+  only:
+    - tags
+  allow_failure: false
+  when: manual
\ No newline at end of file
diff --git a/gitlab/publish.sh b/gitlab/publish.sh
new file mode 100644
index 00000000..f7617406
--- /dev/null
+++ b/gitlab/publish.sh
@@ -0,0 +1,6 @@
+OIFS=$IFS
+IFS='/' read -r first a <<< "$CI_COMMIT_TAG"
+cd $first
+IFS=$OIFS
+cargo login $DUNITER_CRATES_TOKEN
+cargo publish
\ No newline at end of file
-- 
GitLab