-
Notifications
You must be signed in to change notification settings - Fork 7
59 lines (55 loc) · 1.52 KB
/
docs_pr.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
56
57
58
59
name: Deploy PR previews
on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed
permissions: write-all
concurrency: preview-${{ github.ref }}
defaults:
run:
shell: bash
jobs:
deploy-preview:
runs-on: ubuntu-20.04
env:
HUGO_VERSION: 0.123.8
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
run: sudo snap install dart-sass
-
name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
-
name: Install Node.js dependencies
working-directory: ./docs
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
-
name: Build with Hugo
working-directory: ./docs
if: github.event.action != 'closed' # skip the build if the PR has been closed
env:
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
hugo \
--gc \
--minify \
--baseURL "https://docs.natster.io/pr-preview/pr-${{ github.event.number }}"
-
name: Deploy preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./docs/public/
custom-url: "docs.natster.io"