Skip to content

Commit 5762c1b

Browse files
authored
Merge pull request #2 from shiftleftcyber/addHugoWorkflow
Add hugo workflow
2 parents 8c1356b + ebe73b2 commit 5762c1b

1 file changed

Lines changed: 70 additions & 0 deletions

File tree

.github/workflows/hugo.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Deploy Hugo site to Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: false
18+
19+
defaults:
20+
run:
21+
shell: bash
22+
23+
jobs:
24+
build:
25+
runs-on: ubuntu-latest
26+
env:
27+
HUGO_VERSION: 0.139.2
28+
steps:
29+
- name: Install Hugo CLI
30+
run: |
31+
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
32+
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
33+
- name: Install Dart Sass
34+
run: sudo snap install dart-sass
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
with:
38+
submodules: recursive
39+
fetch-depth: 0
40+
- name: Setup Pages
41+
id: pages
42+
uses: actions/configure-pages@v5
43+
- name: Install Node.js dependencies
44+
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
45+
- name: Build with Hugo
46+
env:
47+
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
48+
HUGO_ENVIRONMENT: production
49+
TZ: America/Los_Angeles
50+
run: |
51+
hugo \
52+
--gc \
53+
--minify \
54+
--baseURL "${{ steps.pages.outputs.base_url }}/"
55+
- name: Upload artifact
56+
uses: actions/upload-pages-artifact@v3
57+
with:
58+
path: ./public
59+
60+
# Deployment job
61+
deploy:
62+
environment:
63+
name: github-pages
64+
url: ${{ steps.deployment.outputs.page_url }}
65+
runs-on: ubuntu-latest
66+
needs: build
67+
steps:
68+
- name: Deploy to GitHub Pages
69+
id: deployment
70+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)