From dcfb46c8a330c5ae066ce889a6ff28a59fe16aa6 Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Fri, 13 Oct 2017 22:56:13 +0200 Subject: [PATCH] WIP: Get Gitlab CI to deploy for us. --- .gitlab-ci.yml | 27 +++++++++++++++++++-------- bin/deploy | 27 +++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 8 deletions(-) create mode 100755 bin/deploy diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dc2c60d..ea40638 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,18 +1,29 @@ image: ruby:2.4.2 -variables: - GEMSPEC: "autonomic.gemspec" - stages: - - site-build + - build - deploy -site-builder: - stage: site-build +build: + stage: build before_script: - gem install jekyll script: - - jekyll build + - jekyll build -d public artifacts: paths: - - dist + - public + +deploy: + stage: deploy + before_script: + - gem install jekyll + script: + - jekyll build -d public + - ./bin/deploy + artifacts: + paths: + - public + # only: + # - master + # - tags diff --git a/bin/deploy b/bin/deploy new file mode 100755 index 0000000..489514b --- /dev/null +++ b/bin/deploy @@ -0,0 +1,27 @@ +#!/bin/bash + +GITUSERNAME="autonomicgitlabci" +GITUSEREMAIL="autonomicgitlabci@nowhere.com" +DEPLOYSCRIPT="https://github.com/X1011/git-directory-deploy/raw/master/deploy.sh" + +export GIT_DEPLOY_DIR="public" +export GIT_DEPLOY_BRANCH="production" +export GIT_DEPLOY_REPO="git@gitlab.com:autonomic-cooperative/autonomic-cooperative.gitlab.io.git" + +apt-get update -y +apt-get install -yqq wget openssh-client + +wget $DEPLOYSCRIPT && chmod +x deploy.sh + +git config --global user.email $GITUSEREMAIL +git config --global user.name $GITUSERNAME + +mkdir -p ~/.ssh +eval "$(ssh-agent -s)" +ssh-add <(echo "$SSH_PRIVATE_KEY") +echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config + +# ./deploy.sh -m "Git tag: $(git describe --exact-match HEAD)" +./deploy.sh -m "Hello, World!" + +rm -Rfv .ssh