-
Notifications
You must be signed in to change notification settings - Fork 41
69 lines (54 loc) · 2.09 KB
/
deploy.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
66
67
68
69
---
name: Deploy frontend
on:
push:
branches:
- master
- staging
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Set up WARP
uses: fscarmen/[email protected]
- env:
SSH_PRIVATE_KEY: "${{secrets.SSH_PRIVATE_KEY}}"
name: "Create SSH key"
run: |
mkdir -p ~/.ssh/
echo "$SSH_PRIVATE_KEY" > ~/.ssh/private.key
chmod 600 ~/.ssh/private.key
shell: bash
- name: "Checkout"
uses: actions/checkout@v2
- name: "Use python"
uses: actions/setup-python@v2
- name: "Install markdown"
run: sudo apt-get update && sudo apt-get install -y markdown
- name: "Install stuff"
run: sudo apt-get -y install python3-pip rsync openssh-client
- name: "Install timezones stuff?"
run: pip3 install tzdata pytz
- name: "Install pelican"
run: pip3 install pelican Markdown
- name: "Install jinja markdown tag"
run: pip3 install jinja_markdown
- name: "Install yasha"
run: pip3 install yasha
- name: "make all"
run: make all
- env:
IP: "${{secrets.IP}}"
name: "Copy static files"
run: |
rsync static/* out/* root@[$IP]:/state/static/${GITHUB_REF#refs/heads/} -av -e "ssh -o StrictHostKeyChecking=no -i ~/.ssh/private.key" --chown=root:root
shell: bash
- name: "Cloudflare cache reset"
env:
CLOUDFLARE_ZONE1: "${{secrets.CLOUDFLARE_ZONE1}}"
CLOUDFLARE_ZONE2: "${{secrets.CLOUDFLARE_ZONE2}}"
CLOUDFLARE_TOKEN: "${{secrets.CLOUDFLARE_TOKEN}}"
run: |
curl -X POST "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE1/purge_cache" -H "Content-Type:application/json" -H "Authorization: Bearer $CLOUDFLARE_TOKEN" --data '{"purge_everything":true}' --fail
curl -X POST "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE2/purge_cache" -H "Content-Type:application/json" -H "Authorization: Bearer $CLOUDFLARE_TOKEN" --data '{"purge_everything":true}' --fail
shell: bash