From ab34923167bde9dd34a3a56e08ad9d0d752c62bc Mon Sep 17 00:00:00 2001 From: James McDonald Date: Thu, 7 Feb 2019 18:09:19 +0100 Subject: [PATCH 1/3] Add new test --- .gitlab-ci.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 80d27b9..d116479 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,11 +12,17 @@ before_script: - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts -deploy: +Run hugo test: + script: + - hugo + except: + - master + +Deploy site: script: - hugo - rsync -av --delete --exclude presentations public/ james@shee.sh:/srv/www/jamesmcdonald - echo "Purging CloudFlare cache" - - 'curl -X POST "https://api.cloudflare.com/client/v4/zones/8f213feeb6709de2ba2b70dd5cfa704e/purge_cache" -H "X-Auth-Email: $CLOUDFLARE_EMAIL" -H "X-Auth-Key: $CLOUDFLARE_KEY" -H "Content-Type: application/json" --data "{\"purge_everything\": true}"' + - 'curl -s -X POST "https://api.cloudflare.com/client/v4/zones/8f213feeb6709de2ba2b70dd5cfa704e/purge_cache" -H "X-Auth-Email: $CLOUDFLARE_EMAIL" -H "X-Auth-Key: $CLOUDFLARE_KEY" -H "Content-Type: application/json" --data "{\"purge_everything\": true}"' only: - master From 78563ec94df00c8406f94d2db76a4df24ae942fe Mon Sep 17 00:00:00 2001 From: James McDonald Date: Thu, 7 Feb 2019 18:11:22 +0100 Subject: [PATCH 2/3] No before_script for just running hugo --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d116479..15602c9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,6 +13,7 @@ before_script: - chmod 644 ~/.ssh/known_hosts Run hugo test: + before_script: ~ script: - hugo except: From 269fb2d312851a6aae1ad814392ed3bee287f0f0 Mon Sep 17 00:00:00 2001 From: James McDonald Date: Thu, 7 Feb 2019 18:14:00 +0100 Subject: [PATCH 3/3] Move before_script inside deploy job --- .gitlab-ci.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 15602c9..c565672 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,27 +3,27 @@ image: monachus/hugo variables: GIT_SUBMODULE_STRATEGY: recursive -before_script: - - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client rsync -y )' - - eval $(ssh-agent -s) - - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null - - mkdir -p ~/.ssh - - chmod 700 ~/.ssh - - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts - - chmod 644 ~/.ssh/known_hosts - Run hugo test: - before_script: ~ script: - hugo except: - master Deploy site: + before_script: + - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client rsync -y )' + - eval $(ssh-agent -s) + - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts + - chmod 644 ~/.ssh/known_hosts + script: - hugo - rsync -av --delete --exclude presentations public/ james@shee.sh:/srv/www/jamesmcdonald - echo "Purging CloudFlare cache" - 'curl -s -X POST "https://api.cloudflare.com/client/v4/zones/8f213feeb6709de2ba2b70dd5cfa704e/purge_cache" -H "X-Auth-Email: $CLOUDFLARE_EMAIL" -H "X-Auth-Key: $CLOUDFLARE_KEY" -H "Content-Type: application/json" --data "{\"purge_everything\": true}"' + only: - master