Skip to content

Commit 82a1321

Browse files
YASHMAHAKALleecalcote
authored andcommitted
ci: add GitHub Pages build and deploy workflow
Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com> Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
1 parent c282bc5 commit 82a1321

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

.github/workflows/gh-pages.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Build and Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths-ignore:
8+
- ".github/**"
9+
pull_request:
10+
branches:
11+
- master
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: read
16+
pages: write
17+
id-token: write
18+
19+
concurrency:
20+
group: "pages"
21+
cancel-in-progress: false
22+
23+
jobs:
24+
build:
25+
name: Build Hugo site
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v5
31+
with:
32+
fetch-depth: 0
33+
34+
- name: Setup Go
35+
uses: actions/setup-go@v5
36+
with:
37+
go-version-file: go.mod
38+
cache: true
39+
40+
- name: Setup Hugo Extended
41+
uses: peaceiris/actions-hugo@v3
42+
with:
43+
hugo-version: "0.147.9"
44+
extended: true
45+
46+
- name: Install Node.js dependencies
47+
run: npm ci
48+
49+
- name: Build Hugo site
50+
run: |
51+
hugo --minify \
52+
--baseURL "https://${{ github.repository_owner }}.github.io/academy-example/"
53+
54+
- name: Upload Pages artifact
55+
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
56+
uses: actions/upload-pages-artifact@v3
57+
with:
58+
path: ./public
59+
60+
deploy:
61+
name: Deploy to GitHub Pages
62+
needs: build
63+
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
64+
runs-on: ubuntu-latest
65+
environment:
66+
name: github-pages
67+
url: ${{ steps.deployment.outputs.page_url }}
68+
69+
steps:
70+
- name: Deploy to GitHub Pages
71+
id: deployment
72+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)