-
Notifications
You must be signed in to change notification settings - Fork 7
80 lines (74 loc) · 2.4 KB
/
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Deploy Hugo site to Hosting
on:
# Runs on pushes targeting the default branch
push:
branches:
- hugo
- master
permissions:
contents: read
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "hosting"
cancel-in-progress: false
# Default to bash
defaults:
run:
shell: bash
jobs:
# Build job
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.137.0
THEME_VERSION: 1.3.0
THEME: hugo-geekdoc
BASEDIR: docs
THEMEDIR: ./themes
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass Embedded
run: sudo snap install dart-sass-embedded
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js dependencies
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
- name: Create folder for template
run: mkdir -p ${THEMEDIR}/${THEME}/
- name: Download template
run: curl -sSL "https://github.com/thegeeklab/${THEME}/releases/download/v${THEME_VERSION}/${THEME}.tar.gz" | tar -xz -C ${THEMEDIR}/${THEME}/ --strip-components=1
- name: Build with Hugo
env:
# For maximum backward compatibility with Hugo modules
HUGO_ENVIRONMENT: production
run: |
hugo --gc --minify
- name: Archive hugo artifacts
uses: actions/upload-artifact@v4
with:
name: hugo-artifact
path: ./public
deploy-hosting:
runs-on: ubuntu-latest
environment: jino
needs: build
steps:
- uses: actions/checkout@v4
- name: Download hugo artifact
uses: actions/download-artifact@v4
with:
name: hugo-artifact
path: public
- name: rsync deployments
uses: burnett01/rsync-deployments@7.0.1
with:
switches: -avzr --delete
path: public/
remote_path: ./domains/${{ vars.DOMAIN_NAME }}/
remote_host: ${{ vars.SFTP_HOST }}
remote_user: ${{ secrets.SFTP_USER }}
remote_key: ${{ secrets.SFTP_KEY }}