Skip to content

Commit 4d5c68f

Browse files
author
Splitter
committed
ci(starters): upgrade
1 parent cc65ebf commit 4d5c68f

File tree

2 files changed

+105
-105
lines changed

2 files changed

+105
-105
lines changed

.github/workflows/deploy.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Deploy website to GitHub Pages
2+
3+
env:
4+
WC_HUGO_VERSION: '0.148.2'
5+
NODE_VERSION: '20'
6+
7+
on:
8+
# Trigger the workflow every time you push to the `main` branch
9+
push:
10+
branches: ['main']
11+
# Allows you to run this workflow manually from the Actions tab on GitHub.
12+
workflow_dispatch:
13+
14+
# Provide permission to clone the repo and deploy it to GitHub Pages
15+
permissions:
16+
contents: read
17+
pages: write
18+
id-token: write
19+
20+
concurrency:
21+
group: 'pages'
22+
cancel-in-progress: false
23+
24+
jobs:
25+
# Build website
26+
build:
27+
if: github.repository_owner != 'HugoBlox'
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
with:
33+
# Fetch history for Hugo's .GitInfo and .Lastmod
34+
fetch-depth: 0
35+
36+
- name: Setup Node.js
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: ${{ env.NODE_VERSION }}
40+
41+
- name: Setup pnpm
42+
if: hashFiles('package.json') != ''
43+
uses: pnpm/action-setup@v4
44+
45+
- name: Install dependencies
46+
run: |
47+
# Install Tailwind CLI if package.json exists
48+
if [ -f "package.json" ]; then
49+
echo "Installing Tailwind dependencies..."
50+
pnpm install || npm install
51+
fi
52+
53+
- name: Setup Hugo
54+
uses: peaceiris/actions-hugo@v3
55+
with:
56+
hugo-version: ${{ env.WC_HUGO_VERSION }}
57+
extended: true
58+
59+
- uses: actions/cache@v4
60+
with:
61+
path: |
62+
/tmp/hugo_cache_runner/
63+
node_modules/
64+
modules/*/node_modules/
65+
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.mod', '**/package-lock.json', '**/pnpm-lock.yaml') }}
66+
restore-keys: |
67+
${{ runner.os }}-hugomod-
68+
69+
- name: Setup Pages
70+
id: pages
71+
uses: actions/configure-pages@v5
72+
73+
- name: Build with Hugo
74+
env:
75+
HUGO_ENVIRONMENT: production
76+
run: |
77+
echo "Hugo Cache Dir: $(hugo config | grep cachedir)"
78+
hugo --minify --baseURL "${{ steps.pages.outputs.base_url }}/"
79+
80+
- name: Generate Pagefind search index (if applicable)
81+
run: |
82+
# Check if site uses Pagefind
83+
if [ -f "package.json" ] && grep -q "pagefind" package.json; then
84+
pnpm dlx pagefind --source "public" || npx pagefind --source "public"
85+
elif [ -f "netlify.toml" ] && grep -q "pagefind" netlify.toml; then
86+
pnpm dlx pagefind --source "public" || npx pagefind --source "public"
87+
fi
88+
89+
- name: Upload artifact
90+
uses: actions/upload-pages-artifact@v4
91+
with:
92+
path: ./public
93+
94+
# Deploy website to GitHub Pages hosting
95+
deploy:
96+
if: github.repository_owner != 'HugoBlox'
97+
environment:
98+
name: github-pages
99+
url: ${{ steps.deployment.outputs.page_url }}
100+
runs-on: ubuntu-latest
101+
needs: build
102+
steps:
103+
- name: Deploy to GitHub Pages
104+
id: deployment
105+
uses: actions/deploy-pages@v4

.github/workflows/publish.yaml

Lines changed: 0 additions & 105 deletions
This file was deleted.

0 commit comments

Comments
 (0)