Skip to content

Commit 035e360

Browse files
committed
chore: gh pages deploys actions workflow
1 parent ed79535 commit 035e360

File tree

2 files changed

+101
-0
lines changed

2 files changed

+101
-0
lines changed

.github/workflows/hugo.yaml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# flow from https://gohugo.io/host-and-deploy/host-on-github-pages/
2+
3+
# Sample workflow for building and deploying a Hugo site to GitHub Pages
4+
name: Deploy Hugo site to Pages
5+
6+
on:
7+
# Runs on pushes targeting the default branch
8+
push:
9+
branches:
10+
- main
11+
12+
# Allows you to run this workflow manually from the Actions tab
13+
workflow_dispatch:
14+
15+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
16+
permissions:
17+
contents: read
18+
pages: write
19+
id-token: write
20+
21+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
22+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
23+
concurrency:
24+
group: "pages"
25+
cancel-in-progress: false
26+
27+
# Default to bash
28+
defaults:
29+
run:
30+
shell: bash
31+
32+
jobs:
33+
# Build job
34+
build:
35+
runs-on: ubuntu-latest
36+
env:
37+
HUGO_VERSION: 0.145.0
38+
HUGO_ENVIRONMENT: production
39+
TZ: America/Los_Angeles
40+
steps:
41+
- name: Install Hugo CLI
42+
run: |
43+
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
44+
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
45+
#- name: Install Dart Sass
46+
# run: sudo snap install dart-sass
47+
- name: Checkout
48+
uses: actions/checkout@v4
49+
with:
50+
submodules: recursive
51+
fetch-depth: 0
52+
- name: Setup Pages
53+
id: pages
54+
uses: actions/configure-pages@v5
55+
- name: Install Node.js dependencies
56+
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
57+
- name: Cache Restore
58+
id: cache-restore
59+
uses: actions/cache/restore@v4
60+
with:
61+
path: |
62+
${{ runner.temp }}/hugo_cache
63+
key: hugo-${{ github.run_id }}
64+
restore-keys:
65+
hugo-
66+
- name: Build with Hugo
67+
run: |
68+
cd exampleSite; \
69+
hugo \
70+
--gc \
71+
--minify \
72+
--baseURL "${{ steps.pages.outputs.base_url }}/" \
73+
--cacheDir "${{ runner.temp }}/hugo_cache"
74+
- name: Cache Save
75+
id: cache-save
76+
uses: actions/cache/save@v4
77+
with:
78+
path: |
79+
${{ runner.temp }}/hugo_cache
80+
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
81+
- name: Upload artifact
82+
uses: actions/upload-pages-artifact@v3
83+
with:
84+
path: ./public
85+
86+
# Deployment job
87+
deploy:
88+
environment:
89+
name: github-pages
90+
url: ${{ steps.deployment.outputs.page_url }}
91+
runs-on: ubuntu-latest
92+
needs: build
93+
steps:
94+
- name: Deploy to GitHub Pages
95+
id: deployment
96+
uses: actions/deploy-pages@v4

exampleSite/hugo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ title = 'Rusty Typewriter'
55
theme = 'rusty-typewriter'
66
themesdir = '../..'
77

8+
# ghpages stuff
9+
[caches]
10+
[caches.images]
11+
dir = ':cacheDir/images'
12+
813
# rtwt = Rusty Typewriter Theme
914
[params.rtwt.side.home]
1015
taxonomies = ['tags','series']

0 commit comments

Comments
 (0)