-
Notifications
You must be signed in to change notification settings - Fork 9
48 lines (44 loc) · 1.52 KB
/
pr-preview-build.yml
File metadata and controls
48 lines (44 loc) · 1.52 KB
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
name: PR Preview Build
on:
pull_request:
branches: [master]
permissions:
contents: read
concurrency:
group: pr-preview-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
build:
name: Build Preview
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
submodules: recursive
- name: Setup Hugo
uses: peaceiris/actions-hugo@2752ce1d29631191ea3f27c23495fa06139a5b78 # v3.2.1
with:
hugo-version: '0.78.1'
extended: true
- name: Compute preview base URL
id: base
run: |
OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
REPO="${{ github.event.repository.name }}"
echo "url=https://${OWNER}.github.io/${REPO}/pr-previews/pr-${{ github.event.number }}/" >> "$GITHUB_OUTPUT"
- name: Build website
run: hugo --gc --minify --buildFuture -b "${{ steps.base.outputs.url }}"
- name: Save PR number
run: |
mkdir -p ./pr-metadata
echo "${{ github.event.number }}" > ./pr-metadata/pr-number
- name: Upload preview artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: preview-site
path: ./public
- name: Upload PR metadata
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: pr-metadata
path: ./pr-metadata