-
Notifications
You must be signed in to change notification settings - Fork 4
44 lines (36 loc) · 1.13 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
name: Deploy
concurrency:
cancel-in-progress: true
group: staging # TODO stage/prod separate
on:
push:
jobs:
Build:
uses: ./.github/workflows/build.yml
with:
hugo_env: staging # TODO stage/prod
Deploy:
runs-on: ubuntu-latest
environment: staging # TODO stage/prod
needs: Build
steps:
- name: Download HTML
uses: actions/download-artifact@v3
with:
name: html
path: html
- name: Setup SSH
uses: shimataro/ssh-key-action@v2
with:
key: "${{ secrets.SSH_PRIVATE_KEY }}"
known_hosts: "${{ vars.SSH_KNOWN_HOSTS }}"
- name: Rsync
env:
SSH_HOST: "${{ vars.SSH_HOST }}"
SSH_USER: "${{ secrets.SSH_USER }}"
run: rsync -rptcivh --delete-after --stats ./html/ "$SSH_USER@$SSH_HOST:/home/public"
- name: Purge Cloudflare Cache
env:
CF_AUTH: "Authorization: Bearer ${{ secrets.CF_API_TOKEN }}"
CF_URL: "https://api.cloudflare.com/client/v4/zones/${{ secrets.CF_ZONE_ID }}/purge_cache"
run: curl -f "$CF_URL" -H "$CF_AUTH" --data '{"purge_everything":true}'