Skip to content

Commit 3374a4b

Browse files
committed
new way
1 parent 904e374 commit 3374a4b

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

.github/workflows/hugo.yaml

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

0 commit comments

Comments
 (0)