-
Notifications
You must be signed in to change notification settings - Fork 14
55 lines (48 loc) · 1.43 KB
/
deploy-prod.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
---
name: Deploy website to production server
on: # yamllint disable-line rule:truthy
push:
branches:
- main
schedule:
- cron: '22 2 * * *'
jobs:
deploy:
runs-on: ubuntu-22.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.121.2'
extended: true
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Prepare npm
run: npm ci
- name: Build
env:
HUGO_ENV: production
HUGO_MATRIX_ACCESS_TOKEN: ${{ secrets.HUGO_MATRIX_ACCESS_TOKEN }}
HUGO_MATRIX_HOME_SERVER: ${{ secrets.HUGO_MATRIX_HOME_SERVER }}
HUGO_GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
URL_PRODUCTION: ${{ vars.URL_PRODUCTION }}
run: hugo --minify -b "$URL_PRODUCTION"
- name: Deploy
uses: appleboy/scp-action@master
with:
host: ${{ vars.IP_PRODUCTION }}
username: ${{ secrets.SSH_USERNAME_PRODUCTION }}
key: ${{ secrets.SSH_KEY_PRODUCTION }}
source: "public/"
target: ${{ vars.WEBROOT_PRODUCTION }}
strip_components: 1