Browse Source

Update deployment

master
Drew Short 6 years ago
parent
commit
0974f7b97e
  1. 34
      .gitlab-ci.yml

34
.gitlab-ci.yml

@ -2,37 +2,41 @@ stages:
- build
- deploy
site-build:
image: jojomi/hugo
build-website:
image: sothr.com/hugo:0.54.0
stage: build
variables:
HUGO_THEME: "hyde"
HUGO_BASEURL: "https://blog.nulloctet.com/"
script:
- hugo
- export HUGO_SOURCE="$PWD"
- /run.sh --minify
- tar -czvf website.tgz -C /output/ .
only:
- master
artifacts:
paths:
- public
expire_in: 1 week
tags:
- docker
artifacts:
paths:
- website.tgz
site-deploy:
image: panubo/sshd:latest
deploy-website:
image: sothr.com/deploy:ubuntu
stage: deploy
variables:
DEPLOY_USER: "deploy"
DEPLOY_HOST: "162.243.78.94"
DEPLOY_PORT: "9140"
TARGET_DIRECTORY: "~/blog.nulloctet.com"
script:
- echo "Deployment To Production Starting..."
- eval `ssh-agent -s`
- ssh-add <(echo "$SSH_DEPLOY_KEY")
- rsync -avz --delete-delay -e "ssh -p $DEPLOY_PORT -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --progress public/* $DEPLOY_USER@$DEPLOY_HOST:$TARGET_DIRECTORY
- 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:
- site-build
- build-website
tags:
- docker
environment: production
Loading…
Cancel
Save