-
Notifications
You must be signed in to change notification settings - Fork 3
48 lines (40 loc) · 1.44 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
name: website-preview
on:
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out main
uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
- name: update baseURL for preview website
run: echo "baseURL = \"https://preview.loongarch.dev/${{ github.event.pull_request.number }}\"" > config/preview/config.toml
- name: Build
run: hugo --minify --environment preview --cleanDestinationDir
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
external_repository: loongarch64/website-preview
allow_empty_commit: true
publish_dir: ./public
cname: preview.loongarch.dev
destination_dir: ${{ github.event.pull_request.number }}
force_orphan: false
- name: Update status
uses: Sibz/github-status-action@v1
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: 'website-preview / deploy (update)'
description: 'Deployed, click "Details" to view ->'
state: 'success'
target_url: https://preview.loongarch.dev/${{ github.event.pull_request.number }}
sha: ${{github.event.pull_request.head.sha || github.sha}}