From 384cd92f4b42b7f808c53300e2a95110c2b93d2e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Erik=20Hedenstro=CC=88m?= <erik@hedenstroem.com>
Date: Wed, 25 Nov 2015 14:42:41 +0100
Subject: [PATCH] Added publishing tasks

---
 .gitignore     |  1 +
 .gitlab-ci.yml | 31 ++++++++++++++++---------------
 2 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/.gitignore b/.gitignore
index 755b605..725dd6c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@
 /deps
 erl_crash.dump
 *.ez
+*.tar
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 659dd7e..894aca7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,28 +1,29 @@
 before_script:
-  - banner "Environment"
-  - env | sort
-  - docker info
   - git config --global url.https://.insteadOf git://
   - mkdir -p ~/.hex
   - printf "{key,<<\"$HEX_KEY\">>}.\n{username,<<\"$HEX_USERNAME\">>}.\n" > ~/.hex/hex.config
-  - mix hex.info
 
 stages:
-  - compile
   - test
-
-compile:
-  stage: compile
-  script:
-    - mix deps.get
-    - mix compile
-  tags:
-    - armv7l
+  - publish
 
 test:
   stage: test
   script:
     - mix deps.get
     - mix test
-  tags:
-    - armv7l
+
+hex_publish:
+  stage: publish
+  only:
+    - /^\d+[.]\d+[.]\d+$/ # Only publish HEAD tagged with semantic version
+  script:
+    - mix hex.publish --force
+
+aws_publish:
+  stage: publish
+  only:
+    - /^\d+[.]\d+[.]\d+$/ # Only publish HEAD tagged with semantic version
+  script:
+    - aws s3 cp plug_geoip2-$CI_BUILD_REF_NAME.tar s3://s3.erlang.ninja/plug_geoip2/
+    - aws s3 cp s3://s3.erlang.ninja/plug_geoip2/plug_geoip2-$CI_BUILD_REF_NAME.tar s3://s3.erlang.ninja/plug_geoip2/plug_geoip2-latest.tar
-- 
GitLab