Skip to content

Instantly share code, notes, and snippets.

@jacob-long
Created December 24, 2016 21:58
Show Gist options
  • Save jacob-long/2fb4d75904b65721e0b00e3cf025b464 to your computer and use it in GitHub Desktop.
Save jacob-long/2fb4d75904b65721e0b00e3cf025b464 to your computer and use it in GitHub Desktop.
Hugo to DigitalOcean Wercker file
box: ubuntu
build:
steps:
- arjen/hugo-build:
version: "0.17"
theme: theme-name
flags: --buildDrafts=false --noTimes
deploy:
steps:
- install-packages:
packages: openssh-client rsync
- add-to-known_hosts:
hostname: $HOSTNAME
- mktemp:
envvar: PRIVATEKEY_PATH
- create-file:
name: write key
filename: $PRIVATEKEY_PATH
content: $WERCKER_PRIVATE
overwrite: true
- script:
name: transfer blog
code: |
rsync -au -e "ssh -i $PRIVATEKEY_PATH -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --progress public/* root@$HOSTNAME:/var/www/blog
ssh -i $PRIVATEKEY_PATH -l root -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $HOSTNAME chown -R www-data:www-data /var/www/
- script:
name: restart nginx
code: ssh -i $PRIVATEKEY_PATH -l root -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $HOSTNAME nginx -s reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment