WIP: Get Gitlab CI to deploy for us.

This commit is contained in:
Luke Murphy 2017-10-13 22:56:13 +02:00
parent e03ca1673e
commit dcfb46c8a3
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
2 changed files with 46 additions and 8 deletions

View File

@ -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

27
bin/deploy Executable file
View File

@ -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