-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (46 loc) · 1.41 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
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow
name: Hugo CI & Deploy
on:
push:
branches:
- main
jobs:
build:
name: Build and deploy website
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true
- name: cache
uses: actions/cache@v2
with:
path: /tmp/hugo_cache
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-hugomod-
- name: Build website with Hugo
run: hugo --minify
- name: Deploy website with rsync
uses: burnett01/rsync-deployments@5.2.1
with:
switches: -avzr --quiet --delete
path: public/
remote_path: ${{ secrets.REMOTE_PATH }}
remote_host: ${{ secrets.REMOTE_HOST }}
remote_user: ${{ secrets.REMOTE_USER }}
remote_key: ${{ secrets.REMOTE_KEY }}
- name: Set file permissions
uses: appleboy/ssh-action@v0.1.8
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.REMOTE_KEY }}
script: "sudo chown -R ${{ secrets.REMOTE_USER }}:www-data ${{ secrets.REMOTE_PATH }}"