Skip to content

Commit f79dc64

Browse files
Merge pull request #20 from Lemon73-Computing/lemon73/fix-display
ci: replace github-pages-deploy-action@v4 with hugo official suggestion
2 parents 3c1981d + bafdd38 commit f79dc64

File tree

1 file changed

+81
-37
lines changed

1 file changed

+81
-37
lines changed

.github/workflows/deploy.yml

+81-37
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,94 @@
1-
name: Deploy to Github Pages
1+
name: Deploy Hugo site to Pages
22

33
on:
4+
# Runs on pushes targeting the default branch
45
push:
5-
branches: [main]
6-
pull_request:
7-
branches: [main]
6+
branches:
7+
- main
8+
9+
# Allows you to run this workflow manually from the Actions tab
810
workflow_dispatch:
911

12+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20+
concurrency:
21+
group: "pages"
22+
cancel-in-progress: false
23+
24+
# Default to bash
25+
defaults:
26+
run:
27+
shell: bash
28+
1029
jobs:
30+
# Build job
1131
build:
1232
runs-on: ubuntu-latest
13-
14-
permissions:
15-
# Give the default GITHUB_TOKEN write permission to commit and push the
16-
# added or changed files to the repository.
17-
contents: write
18-
33+
env:
34+
HUGO_VERSION: 0.145.0
35+
HUGO_ENVIRONMENT: production
36+
TZ: America/Los_Angeles
1937
steps:
20-
- uses: actions/checkout@v4
21-
22-
- name: Cache Hugo resources
23-
uses: actions/cache@v4
24-
env:
25-
cache-name: cache-hugo-resources
38+
- name: Install Hugo CLI
39+
run: |
40+
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
41+
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
42+
- name: Install Dart Sass
43+
run: sudo snap install dart-sass
44+
- name: Checkout
45+
uses: actions/checkout@v4
2646
with:
27-
path: resources
28-
key: ${{ env.cache-name }}
29-
30-
- uses: actions/setup-go@v4
47+
submodules: recursive
48+
fetch-depth: 0
49+
- name: Setup Pages
50+
id: pages
51+
uses: actions/configure-pages@v5
52+
- name: Install Node.js dependencies
53+
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
54+
- name: Cache Restore
55+
id: cache-restore
56+
uses: actions/cache/restore@v4
3157
with:
32-
go-version: "^1.24.0"
33-
- run: go version
34-
35-
- name: Setup Hugo
36-
uses: peaceiris/actions-hugo@v3
58+
path: |
59+
${{ runner.temp }}/hugo_cache
60+
key: hugo-${{ github.run_id }}
61+
restore-keys:
62+
hugo-
63+
- name: Configure Git
64+
run: git config core.quotepath false
65+
- name: Build with Hugo
66+
run: |
67+
hugo \
68+
--gc \
69+
--minify \
70+
--baseURL "${{ steps.pages.outputs.base_url }}/" \
71+
--cacheDir "${{ runner.temp }}/hugo_cache"
72+
- name: Cache Save
73+
id: cache-save
74+
uses: actions/cache/save@v4
3775
with:
38-
hugo-version: "latest"
39-
extended: true
40-
41-
- name: Build
42-
run: hugo --minify --gc
43-
44-
- name: Deploy 🚀
45-
uses: JamesIves/github-pages-deploy-action@v4
76+
path: |
77+
${{ runner.temp }}/hugo_cache
78+
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
79+
- name: Upload artifact
80+
uses: actions/upload-pages-artifact@v3
4681
with:
47-
branch: gh-pages
48-
folder: public
49-
clean: true
50-
single-commit: true
82+
path: ./public
83+
84+
# Deployment job
85+
deploy:
86+
environment:
87+
name: github-pages
88+
url: ${{ steps.deployment.outputs.page_url }}
89+
runs-on: ubuntu-latest
90+
needs: build
91+
steps:
92+
- name: Deploy to GitHub Pages
93+
id: deployment
94+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)