-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (42 loc) · 2.21 KB
/
cicd.yaml
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
name: CICD
on:
workflow_dispatch:
push:
branches:
- main
jobs:
build:
name: Build and Deploy
runs-on: ubuntu-latest
steps:
- name: 🛒 Checkout
uses: actions/checkout@v2
- name: ✨ Setup Hugo
env:
HUGO_VERSION: 0.111.3
run: |
mkdir ~/hugo
cd ~/hugo
curl -L "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz" --output hugo.tar.gz
tar -xvzf hugo.tar.gz
sudo mv hugo /usr/local/bin
- name: 🛠️ Build
run: hugo
- name: 🔐 Create Key File
run: install -m 600 -D /dev/null ~/.ssh/id_rsa
- name: 🔑 Populate Key
run: echo "${{ secrets.PRIVATE_KEY }}" > ~/.ssh/id_rsa
- name: 🚀 Deploy blog/
run: rsync --archive --delete --stats -e 'ssh -p 18765 -o StrictHostKeyChecking=no' 'public/blog/' 'swharden.com@ssh.swharden.com:/home/customer/www/swharden.com/public_html/blog/'
- name: 🚀 Deploy blog/tags/
run: rsync --archive --delete --stats -e 'ssh -p 18765 -o StrictHostKeyChecking=no' 'public/tags/' 'swharden.com@ssh.swharden.com:/home/customer/www/swharden.com/public_html/blog/tags/'
- name: 🚀 Deploy med/
run: rsync --archive --delete --stats -e 'ssh -p 18765 -o StrictHostKeyChecking=no' 'public/med/' 'swharden.com@ssh.swharden.com:/home/customer/www/swharden.com/public_html/med/'
- name: 🚀 Deploy about/
run: rsync --archive --delete --stats -e 'ssh -p 18765 -o StrictHostKeyChecking=no' 'public/about/' 'swharden.com@ssh.swharden.com:/home/customer/www/swharden.com/public_html/about/'
- name: 🚀 Deploy 404/
run: rsync --archive --delete --stats -e 'ssh -p 18765 -o StrictHostKeyChecking=no' 'public/404/' 'swharden.com@ssh.swharden.com:/home/customer/www/swharden.com/public_html/404/'
- name: 🚀 Deploy index.html
run: rsync -e 'ssh -p 18765 -o StrictHostKeyChecking=no' 'public/index.html' 'swharden.com@ssh.swharden.com:/home/customer/www/swharden.com/public_html/index.html'
- name: 🧹 Purge Cache
run: ssh swharden.com@ssh.swharden.com -p 18765 "site-tools-client domain update id=1 flush_cache=1"