-
Notifications
You must be signed in to change notification settings - Fork 4
49 lines (42 loc) · 1.21 KB
/
preview.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
name: Preview site
on:
pull_request:
jobs:
deploy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
submodules: false
fetch-depth: 0
lfs: true
- name: Fetch NPM dependencies
env:
NPM_CONFIG_PREFIX: "~/.npm-global"
run: |
export PATH=$HOME/.npm-global/bin:$PATH
npm install -g @babel/cli @babel/core
yarn
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.111.3'
extended: true
- name: Setup base URL env var
run: |
export PRNUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
echo BASEURL="https://lipukule-site-deploy-pr-"$PRNUMBER".surge.sh/" >> $GITHUB_ENV
- name: Build Site
run: |
hugo --baseURL "${{ env.BASEURL }}"
- name: Deploy Preview
uses: afc163/surge-preview@v1
id: preview_step
with:
surge_token: ${{ secrets.SURGE_TOKEN }}
github_token: ${{ secrets.GH_TOKEN }}
dist: public
failOnError: 'true'
teardown: true
build: |
echo Deploying to surge.sh