-
Notifications
You must be signed in to change notification settings - Fork 18
43 lines (38 loc) · 1.08 KB
/
build-and-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
name: Build and deploy web site
on:
push:
branches:
- main
- staging
pull_request:
jobs:
deploy:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: '0.111.3'
extended: true
- name: Build
run: hugo
- name: Deploy site
if: github.ref == 'refs/heads/main'
env:
SSH_KEY: ${{ secrets.SSH_KEY }}
run: |
eval $(ssh-agent -s)
ssh-add - <<< "${SSH_KEY}"
rsync --exclude=/w --delete -r -e "ssh -o StrictHostKeyChecking=no -p 22" public/ [email protected]:/
- name: Deploy site (staging)
if: github.ref == 'refs/heads/staging'
env:
SSH_KEY: ${{ secrets.SSH_KEY_STAGING }}
run: |
eval $(ssh-agent -s)
ssh-add - <<< "${SSH_KEY}"
rsync --exclude=/w --delete -r -e "ssh -o StrictHostKeyChecking=no -p 22" public/ [email protected]:/