-
Notifications
You must be signed in to change notification settings - Fork 3
/
config.yml
65 lines (63 loc) · 2.01 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
version: 2.1
workflows:
version: 2
build-deploy:
jobs:
#- hugo_job:
# name: deploy-test
- hugo_job:
name: deploy-prod
domain: webbinaro.dev
# requires:
# - deploy-test
context: [ webbsites ]
filters:
branches:
only: master
jobs:
hugo_job:
parameters:
domain:
description: Environment variables prefix. For Eddie this is either TEST or REZ
type: string
default: webbinaro.dev
docker:
- image: eddiewebb/hugo:0.84.4-webp
working_directory: ~/repo
steps:
- checkout
- run:
name: Checkout submodule (theme)
command: |
git submodule sync
git submodule update --init
- run:
name: HUGO build for Test domain
command: |
hugo -v -s ~/repo/src/ --destination /tmp/public -b https://<<parameters.domain>>
ls /tmp/public
if [ ! -f /tmp/public/index.html ];then
echo "index.html not created, failing"
exit 1
fi
- add_ssh_keys
- run:
name: Keyscan (HACK)
command: |
ssh-keyscan -H ${DEPLOY_HOST} >> ~/.ssh/known_hosts
echo "${DEPLOY_KEY}" | base64 -d > ~/.ssh/id_ed25519 && chmod 0600 ~/.ssh/id_ed25519
- run:
name: Deploy public folder to <<parameters.domain>>
command: |
whoami
sudo apt-get install -y rsync
rsync -avz --delete /tmp/public/ ${DEPLOY_USER}@${DEPLOY_HOST}:/var/www/<<parameters.domain>>/
ssh ${DEPLOY_USER}@${DEPLOY_HOST} -C "chown -R www-data:www-data /var/www/<<parameters.domain>>"
- run:
name: Simple content check
command: |
HTTPCODE=`curl -s -o /dev/null -w "%{http_code}" https://<<parameters.domain>>/index.html`
if [ "$HTTPCODE" -ne 200 ];then
echo "index.html not found, failing"
exit 1
fi