From dbdd24e4f5b52f07893fbb228727a1b8c3c32330 Mon Sep 17 00:00:00 2001
From: librelois <elois@ifee.fr>
Date: Sun, 3 Dec 2017 18:51:45 +0100
Subject: [PATCH] add gitlab-ci

---
 .gitlab-ci.yml | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 .gitlab-ci.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..c9ac3c7
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,30 @@
+stages:
+    - github-sync
+    - deploy
+
+push_to_github:
+    stage: github-sync
+    variables:
+        GIT_STRATEGY: none
+    tags:
+        - github
+    script:
+        - rm -rf ./*
+        - rm -rf .git
+        - git clone --mirror $CI_REPOSITORY_URL .
+        - git remote add github $GITHUB_URL_AND_KEY
+        - git config --global user.email "contact@duniter.org"
+        - git config --global user.name "Duniter"
+        # Job would fail if we don't remove refs about pull requests
+        - bash -c "cat packed-refs | grep -v 'refs/pull' > packed-refs-new; echo 'Removed pull refs.'"
+        - mv packed-refs-new packed-refs
+        - bash -c "git push --force --mirror github 2>&1 | grep -v duniter-gitlab; echo $?"
+      
+publish:  
+  stage: deploy
+  only:
+    - tags
+    - triggers
+  script:
+    - echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}'>.npmrc
+    - npm publish
\ No newline at end of file
-- 
GitLab