forked from DataONEorg/dataone-web
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (45 loc) · 1.37 KB
/
deploy-hugo.yaml
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
name: Deploy Hugo Site
on:
push:
branches:
- preview
- main
jobs:
deploy:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Set env vars (preview)
if: endsWith(github.ref, '/preview')
run: |
echo "SITE=preview.dataone.org" >> $GITHUB_ENV
- name: Set env vars (production)
if: endsWith(github.ref, '/main')
run: |
echo "SITE=www.dataone.org" >> $GITHUB_ENV
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "0.82.0"
extended: true
- name: Build Site
run: |
echo "Building site: ${{ env.SITE }}"
npm install
if [ "$env.SITE" = "www.dataone.org" ]; then hugo; else hugo --baseURL=https://${{ env.SITE }}; fi
- name: Deploy Site
uses: dataoneorg/rsync-deploy@v1.0.0
with:
host: ${{ env.SITE }}
port: ${{ secrets.PORT }}
source: "docs/"
target: "/var/www/${{ env.SITE }}"
username: ${{ secrets.USER }}
group: ${{ secrets.GROUP }}
key: ${{ secrets.KEY }}