Skip to content

Commit f914013

Browse files
committed
add GitHub Pages workflow
1 parent 11f753c commit f914013

1 file changed

Lines changed: 84 additions & 0 deletions

File tree

.github/workflows/page.yaml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Build and validate the PIG documentation site, then deploy it to GitHub Pages.
2+
name: Build and Deploy PIG Docs
3+
4+
on:
5+
push:
6+
branches: ["main"]
7+
pull_request:
8+
branches: ["main"]
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
concurrency:
17+
group: pages-${{ github.ref }}
18+
cancel-in-progress: false
19+
20+
defaults:
21+
run:
22+
shell: bash
23+
24+
jobs:
25+
build:
26+
runs-on: ubuntu-latest
27+
env:
28+
HUGO_VERSION: 0.164.0
29+
steps:
30+
- name: Install Hugo CLI
31+
run: |
32+
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
33+
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
34+
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
with:
38+
fetch-depth: 0
39+
submodules: recursive
40+
41+
- name: Setup Go
42+
uses: actions/setup-go@v5
43+
with:
44+
go-version-file: go.mod
45+
cache: true
46+
47+
- name: Setup Pages
48+
id: pages
49+
uses: actions/configure-pages@v5
50+
51+
- name: Check site
52+
env:
53+
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
54+
HUGO_ENVIRONMENT: production
55+
HUGO_ENV: production
56+
run: make check
57+
58+
- name: Build for GitHub Pages
59+
env:
60+
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
61+
HUGO_ENVIRONMENT: production
62+
HUGO_ENV: production
63+
run: |
64+
hugo \
65+
--minify \
66+
--cleanDestinationDir \
67+
--baseURL "${{ steps.pages.outputs.base_url }}/"
68+
69+
- name: Upload Pages artifact
70+
uses: actions/upload-pages-artifact@v3
71+
with:
72+
path: ./public
73+
74+
deploy:
75+
if: github.event_name != 'pull_request'
76+
environment:
77+
name: github-pages
78+
url: ${{ steps.deployment.outputs.page_url }}
79+
runs-on: ubuntu-latest
80+
needs: build
81+
steps:
82+
- name: Deploy to GitHub Pages
83+
id: deployment
84+
uses: actions/deploy-pages@v5

0 commit comments

Comments
 (0)