commit 8a7ea5d339ddc3f5c3d957399b71dbc1b3d15c28 parent 7b26ea04afca4a62eed6a9c719fad592dff2f29c Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Fri, 2 Nov 2018 14:20:09 +0100 Add deploy-staging target and configuration Diffstat:
M | .gitlab-ci.yml | | | 21 | ++++++++++++++++++--- |
M | Makefile | | | 14 | ++++++++++++++ |
2 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml @@ -1,14 +1,29 @@ variables: GIT_SUBMODULE_STRATEGY: recursive -test: +deploy: + #image: alpine:edge # https://pkgs.alpinelinux.org/packages?name=&branch=edge image: registry.gitlab.com/pages/hugo:latest + before_script: + - apk --no-cache add make lftp curl grep + - hugo version script: - - hugo + - make deploy-staging + - sleep 15 + - curl --silent --head https://andersdamsgaard.com | head -n 1 | \ + grep '200' + - curl --silent --head https://www.andersdamsgaard.com | head -n 1 | \ + grep '302' + - curl --silent --head http://andersdamsgaard.com | head -n 1 | \ + grep '302 Found' + - curl --silent --head http://www.andersdamsgaard.com | head -n 1 | \ + grep '302 Found' + # artifacts: + # paths: + # - public except: - master -# deployment will fail until hugo is updated to version 0.50 deploy: #image: alpine:edge # https://pkgs.alpinelinux.org/packages?name=&branch=edge image: registry.gitlab.com/pages/hugo:latest diff --git a/Makefile b/Makefile @@ -7,6 +7,20 @@ local: deploy-locally: export FASTMAILKEY=`pass Online/fastmail-files-ftp-password` && make deploy +deploy-staging: + # generate public/ + hugo + # remove unprocessed images + find public/ \ + -name '*.jpg' -not -name '*resize*.jpg' -not -name '*box*.jpg' \ + -delete + # upload to fastmail + lftp -c "set ftp:list-options -a; \ + open ftp://anders@adamsgaard.dk:$(FASTMAILKEY)@ftp.fastmail.com; \ + lcd ./public; \ + cd /anders.staging.adamsgaard.dk/files/$(DOMAIN); \ + mirror --reverse --delete --use-cache --verbose --parallel=2 -p" + deploy: # generate public/ hugo