-
Notifications
You must be signed in to change notification settings - Fork 25
39 lines (33 loc) · 1.04 KB
/
hugo-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
name: Build and Deploy PR Preview to surge
# testing
on:
pull_request:
jobs:
build_preview:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.83.1'
extended: true
- name: Setup base URL env var
run: |
export PRNUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
echo BASEURL="https://rmoff-rmoff-blog-build_preview-pr-"$PRNUMBER".surge.sh/" >> $GITHUB_ENV
- name: Report base URL env var
run: echo "${{ env.BASEURL }}"
- name: Build
run: hugo --baseURL "${{ env.BASEURL }}"
- name: Deploy to surge
uses: afc163/surge-preview@v1
id: preview_step
with:
surge_token: "1f147e7d61488c3db6957c80ab45939f"
github_token: ${{ secrets.GITHUB_TOKEN }}
dist: public
failOnError: false
teardown: true
build: |
echo Deploying to surge.sh