You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1014 B
42 lines
1014 B
stages:
|
|
- build
|
|
- deploy
|
|
|
|
build-website:
|
|
image: sothr.com/hugo:0.54.0
|
|
stage: build
|
|
variables:
|
|
HUGO_THEME: "hyde"
|
|
HUGO_BASEURL: "https://blog.nulloctet.com/"
|
|
script:
|
|
- export HUGO_SOURCE="$PWD"
|
|
- /run.sh --minify
|
|
- tar -czvf website.tgz -C /output/ .
|
|
only:
|
|
- master
|
|
tags:
|
|
- docker
|
|
artifacts:
|
|
paths:
|
|
- website.tgz
|
|
|
|
deploy-website:
|
|
image: sothr.com/deploy:ubuntu
|
|
stage: deploy
|
|
variables:
|
|
TARGET_DIRECTORY: "~/blog.nulloctet.com"
|
|
script:
|
|
- eval `ssh-agent -s`
|
|
- ssh-add <(echo "$SSH_DEPLOY_KEY")
|
|
- mkdir -p ~/.ssh
|
|
- ssh-keyscan -p $DEPLOY_PORT sothr.com >> ~/.ssh/known_hosts
|
|
- mkdir /tmp/deploy
|
|
- tar -xvf website.tgz -C /tmp/deploy
|
|
- rsync -avz --delete-delay -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p $DEPLOY_PORT" --progress /tmp/deploy/* $DEPLOY_USER@$DEPLOY_HOST:$TARGET_DIRECTORY
|
|
only:
|
|
- master
|
|
dependencies:
|
|
- build-website
|
|
tags:
|
|
- docker
|
|
environment: production
|