ci(starters): faster GitHub Pages builds

Added resource caching
This commit is contained in:
George Cushen committed 2025-08-25 18:47:10 +01:00
1 parent 72a4cedcdc
commit b8a8431ac3
13 files changed
+657 -56

No files matched your search

+84 -20
View File
@@ -1,32 +1,96 @@
# ============================================================================
# Hugo Blox Builder - Monorepo .gitignore
# ============================================================================
# ============================================================================
# Build Artifacts & Generated Files
# ============================================================================
# Hugo build artifacts
public/
resources/
.hugo_build.lock
hugo_stats.json
# Go modules
go.sum
# Node.js
node_modules/
# Pagefind search index (generated at build time)
**/pagefind/
# JSConfig files (auto-generated by Hugo)
**/assets/jsconfig.json
# pnpm lock files in starters (keep template clean)
starters/**/pnpm-lock.yaml
# ============================================================================
# Development Environment
# ============================================================================
# Environment variables
.env
.env.local
.env.*.local
# IDE specific
# IDE & Editor files
.idea/
.vscode/
# Jupyter
# ============================================================================
# Language & Framework Specific
# ============================================================================
# Python (for scripts)
__pycache__/
*.py[cod]
*$py.class
.pytest_cache/
*.egg-info/
# Jupyter Notebooks
.ipynb_checkpoints/
# Node
node_modules/
# ============================================================================
# Operating System
# ============================================================================
# Hugo
.hugo_build.lock
go.sum
resources/
public/
**/assets/jsconfig.json
# Pagefind search index (generated)
**/pagefind/
# Mac
# macOS
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
# Test
test/go.sum
hugo_stats.json
# Windows
Thumbs.db
ehthumbs.db
Desktop.ini
# Starter templates
starters/**/pnpm-lock.yaml
# Linux
*~
.nfs*
# ============================================================================
# Logs & Temporary Files
# ============================================================================
# Log files
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Temporary directories
tmp/
temp/
.tmp/
+19 -5
View File
@@ -8,7 +8,7 @@ on:
# Trigger the workflow every time you push to the `main` branch
push:
branches: ['main']
# Allows you to run this workflow manually from the Actions tab on GitHub.
# Allows you to run this workflow manually from the Actions tab on GitHub
workflow_dispatch:
# Provide permission to clone the repo and deploy it to GitHub Pages
@@ -56,15 +56,24 @@ jobs:
hugo-version: ${{ env.WC_HUGO_VERSION }}
extended: true
# Cache dependencies (Go modules, node_modules) - stable, rarely changes
- uses: actions/cache@v4
with:
path: |
/tmp/hugo_cache_runner/
node_modules/
modules/*/node_modules/
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.mod', '**/package-lock.json', '**/pnpm-lock.yaml') }}
key: ${{ runner.os }}-hugo-deps-${{ hashFiles('**/go.mod', '**/package-lock.json', '**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-hugomod-
${{ runner.os }}-hugo-deps-
# Cache Hugo resources (processed images, CSS) - invalidates only when assets/config change
- uses: actions/cache@v4
with:
path: resources/
key: ${{ runner.os }}-hugo-resources-${{ hashFiles('assets/**/*', 'config/**/*', 'hugo.yaml', 'package.json') }}
restore-keys: |
${{ runner.os }}-hugo-resources-
- name: Setup Pages
id: pages
@@ -79,7 +88,7 @@ jobs:
- name: Generate Pagefind search index (if applicable)
run: |
# Check if site uses Pagefind
# Check if site uses Pagefind search
if [ -f "package.json" ] && grep -q "pagefind" package.json; then
pnpm dlx pagefind --source "public" || npx pagefind --source "public"
elif [ -f "netlify.toml" ] && grep -q "pagefind" netlify.toml; then
@@ -94,11 +103,16 @@ jobs:
# Deploy website to GitHub Pages hosting
deploy:
if: github.repository_owner != 'HugoBlox'
needs: build
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
+77
View File
@@ -0,0 +1,77 @@
# ============================================================================
# Hugo Site .gitignore
# ============================================================================
# ============================================================================
# Hugo Build Artifacts
# ============================================================================
# Generated site output
public/
# Hugo resources (processed assets)
resources/
# Hugo build lock
.hugo_build.lock
# Hugo stats
hugo_stats.json
# Auto-generated JS config
**/assets/jsconfig.json
# ============================================================================
# Node.js & Package Managers
# ============================================================================
# Dependencies
node_modules/
# ============================================================================
# Environment & Configuration
# ============================================================================
# Environment variables
.env
.env.local
.env.*.local
# ============================================================================
# Development Tools
# ============================================================================
# IDE & Editors
.vscode/
.idea/
# ============================================================================
# Generated Content
# ============================================================================
# Pagefind search index
pagefind/
static/pagefind/
# ============================================================================
# Operating System
# ============================================================================
# macOS
.DS_Store
.DS_Store?
._*
# Windows
Thumbs.db
Desktop.ini
# Linux
*~
# ============================================================================
# Logs & Temporary Files
# ============================================================================
*.log
npm-debug.log*
+19 -5
View File
@@ -8,7 +8,7 @@ on:
# Trigger the workflow every time you push to the `main` branch
push:
branches: ['main']
# Allows you to run this workflow manually from the Actions tab on GitHub.
# Allows you to run this workflow manually from the Actions tab on GitHub
workflow_dispatch:
# Provide permission to clone the repo and deploy it to GitHub Pages
@@ -56,15 +56,24 @@ jobs:
hugo-version: ${{ env.WC_HUGO_VERSION }}
extended: true
# Cache dependencies (Go modules, node_modules) - stable, rarely changes
- uses: actions/cache@v4
with:
path: |
/tmp/hugo_cache_runner/
node_modules/
modules/*/node_modules/
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.mod', '**/package-lock.json', '**/pnpm-lock.yaml') }}
key: ${{ runner.os }}-hugo-deps-${{ hashFiles('**/go.mod', '**/package-lock.json', '**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-hugomod-
${{ runner.os }}-hugo-deps-
# Cache Hugo resources (processed images, CSS) - invalidates only when assets/config change
- uses: actions/cache@v4
with:
path: resources/
key: ${{ runner.os }}-hugo-resources-${{ hashFiles('assets/**/*', 'config/**/*', 'hugo.yaml', 'package.json') }}
restore-keys: |
${{ runner.os }}-hugo-resources-
- name: Setup Pages
id: pages
@@ -79,7 +88,7 @@ jobs:
- name: Generate Pagefind search index (if applicable)
run: |
# Check if site uses Pagefind
# Check if site uses Pagefind search
if [ -f "package.json" ] && grep -q "pagefind" package.json; then
pnpm dlx pagefind --source "public" || npx pagefind --source "public"
elif [ -f "netlify.toml" ] && grep -q "pagefind" netlify.toml; then
@@ -94,11 +103,16 @@ jobs:
# Deploy website to GitHub Pages hosting
deploy:
if: github.repository_owner != 'HugoBlox'
needs: build
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
+77
View File
@@ -0,0 +1,77 @@
# ============================================================================
# Hugo Site .gitignore
# ============================================================================
# ============================================================================
# Hugo Build Artifacts
# ============================================================================
# Generated site output
public/
# Hugo resources (processed assets)
resources/
# Hugo build lock
.hugo_build.lock
# Hugo stats
hugo_stats.json
# Auto-generated JS config
**/assets/jsconfig.json
# ============================================================================
# Node.js & Package Managers
# ============================================================================
# Dependencies
node_modules/
# ============================================================================
# Environment & Configuration
# ============================================================================
# Environment variables
.env
.env.local
.env.*.local
# ============================================================================
# Development Tools
# ============================================================================
# IDE & Editors
.vscode/
.idea/
# ============================================================================
# Generated Content
# ============================================================================
# Pagefind search index
pagefind/
static/pagefind/
# ============================================================================
# Operating System
# ============================================================================
# macOS
.DS_Store
.DS_Store?
._*
# Windows
Thumbs.db
Desktop.ini
# Linux
*~
# ============================================================================
# Logs & Temporary Files
# ============================================================================
*.log
npm-debug.log*
+19 -5
View File
@@ -8,7 +8,7 @@ on:
# Trigger the workflow every time you push to the `main` branch
push:
branches: ['main']
# Allows you to run this workflow manually from the Actions tab on GitHub.
# Allows you to run this workflow manually from the Actions tab on GitHub
workflow_dispatch:
# Provide permission to clone the repo and deploy it to GitHub Pages
@@ -56,15 +56,24 @@ jobs:
hugo-version: ${{ env.WC_HUGO_VERSION }}
extended: true
# Cache dependencies (Go modules, node_modules) - stable, rarely changes
- uses: actions/cache@v4
with:
path: |
/tmp/hugo_cache_runner/
node_modules/
modules/*/node_modules/
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.mod', '**/package-lock.json', '**/pnpm-lock.yaml') }}
key: ${{ runner.os }}-hugo-deps-${{ hashFiles('**/go.mod', '**/package-lock.json', '**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-hugomod-
${{ runner.os }}-hugo-deps-
# Cache Hugo resources (processed images, CSS) - invalidates only when assets/config change
- uses: actions/cache@v4
with:
path: resources/
key: ${{ runner.os }}-hugo-resources-${{ hashFiles('assets/**/*', 'config/**/*', 'hugo.yaml', 'package.json') }}
restore-keys: |
${{ runner.os }}-hugo-resources-
- name: Setup Pages
id: pages
@@ -79,7 +88,7 @@ jobs:
- name: Generate Pagefind search index (if applicable)
run: |
# Check if site uses Pagefind
# Check if site uses Pagefind search
if [ -f "package.json" ] && grep -q "pagefind" package.json; then
pnpm dlx pagefind --source "public" || npx pagefind --source "public"
elif [ -f "netlify.toml" ] && grep -q "pagefind" netlify.toml; then
@@ -94,11 +103,16 @@ jobs:
# Deploy website to GitHub Pages hosting
deploy:
if: github.repository_owner != 'HugoBlox'
needs: build
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
+75 -5
View File
@@ -1,7 +1,77 @@
# IDEs
# ============================================================================
# Hugo Site .gitignore
# ============================================================================
# ============================================================================
# Hugo Build Artifacts
# ============================================================================
# Generated site output
public/
# Hugo resources (processed assets)
resources/
# Hugo build lock
.hugo_build.lock
# Hugo stats
hugo_stats.json
# Auto-generated JS config
**/assets/jsconfig.json
# ============================================================================
# Node.js & Package Managers
# ============================================================================
# Dependencies
node_modules/
# ============================================================================
# Environment & Configuration
# ============================================================================
# Environment variables
.env
.env.local
.env.*.local
# ============================================================================
# Development Tools
# ============================================================================
# IDE & Editors
.vscode/
.idea/
# Hugo
resources/
public/
jsconfig.json
# ============================================================================
# Generated Content
# ============================================================================
# Pagefind search index
pagefind/
static/pagefind/
# ============================================================================
# Operating System
# ============================================================================
# macOS
.DS_Store
.DS_Store?
._*
# Windows
Thumbs.db
Desktop.ini
# Linux
*~
# ============================================================================
# Logs & Temporary Files
# ============================================================================
*.log
npm-debug.log*
+19 -5
View File
@@ -8,7 +8,7 @@ on:
# Trigger the workflow every time you push to the `main` branch
push:
branches: ['main']
# Allows you to run this workflow manually from the Actions tab on GitHub.
# Allows you to run this workflow manually from the Actions tab on GitHub
workflow_dispatch:
# Provide permission to clone the repo and deploy it to GitHub Pages
@@ -56,15 +56,24 @@ jobs:
hugo-version: ${{ env.WC_HUGO_VERSION }}
extended: true
# Cache dependencies (Go modules, node_modules) - stable, rarely changes
- uses: actions/cache@v4
with:
path: |
/tmp/hugo_cache_runner/
node_modules/
modules/*/node_modules/
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.mod', '**/package-lock.json', '**/pnpm-lock.yaml') }}
key: ${{ runner.os }}-hugo-deps-${{ hashFiles('**/go.mod', '**/package-lock.json', '**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-hugomod-
${{ runner.os }}-hugo-deps-
# Cache Hugo resources (processed images, CSS) - invalidates only when assets/config change
- uses: actions/cache@v4
with:
path: resources/
key: ${{ runner.os }}-hugo-resources-${{ hashFiles('assets/**/*', 'config/**/*', 'hugo.yaml', 'package.json') }}
restore-keys: |
${{ runner.os }}-hugo-resources-
- name: Setup Pages
id: pages
@@ -79,7 +88,7 @@ jobs:
- name: Generate Pagefind search index (if applicable)
run: |
# Check if site uses Pagefind
# Check if site uses Pagefind search
if [ -f "package.json" ] && grep -q "pagefind" package.json; then
pnpm dlx pagefind --source "public" || npx pagefind --source "public"
elif [ -f "netlify.toml" ] && grep -q "pagefind" netlify.toml; then
@@ -94,11 +103,16 @@ jobs:
# Deploy website to GitHub Pages hosting
deploy:
if: github.repository_owner != 'HugoBlox'
needs: build
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
+76
View File
@@ -1 +1,77 @@
# ============================================================================
# Hugo Site .gitignore
# ============================================================================
# ============================================================================
# Hugo Build Artifacts
# ============================================================================
# Generated site output
public/
# Hugo resources (processed assets)
resources/
# Hugo build lock
.hugo_build.lock
# Hugo stats
hugo_stats.json
# Auto-generated JS config
**/assets/jsconfig.json
# ============================================================================
# Node.js & Package Managers
# ============================================================================
# Dependencies
node_modules/
# ============================================================================
# Environment & Configuration
# ============================================================================
# Environment variables
.env
.env.local
.env.*.local
# ============================================================================
# Development Tools
# ============================================================================
# IDE & Editors
.vscode/
.idea/
# ============================================================================
# Generated Content
# ============================================================================
# Pagefind search index
pagefind/
static/pagefind/
# ============================================================================
# Operating System
# ============================================================================
# macOS
.DS_Store
.DS_Store?
._*
# Windows
Thumbs.db
Desktop.ini
# Linux
*~
# ============================================================================
# Logs & Temporary Files
# ============================================================================
*.log
npm-debug.log*
+19 -5
View File
@@ -8,7 +8,7 @@ on:
# Trigger the workflow every time you push to the `main` branch
push:
branches: ['main']
# Allows you to run this workflow manually from the Actions tab on GitHub.
# Allows you to run this workflow manually from the Actions tab on GitHub
workflow_dispatch:
# Provide permission to clone the repo and deploy it to GitHub Pages
@@ -56,15 +56,24 @@ jobs:
hugo-version: ${{ env.WC_HUGO_VERSION }}
extended: true
# Cache dependencies (Go modules, node_modules) - stable, rarely changes
- uses: actions/cache@v4
with:
path: |
/tmp/hugo_cache_runner/
node_modules/
modules/*/node_modules/
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.mod', '**/package-lock.json', '**/pnpm-lock.yaml') }}
key: ${{ runner.os }}-hugo-deps-${{ hashFiles('**/go.mod', '**/package-lock.json', '**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-hugomod-
${{ runner.os }}-hugo-deps-
# Cache Hugo resources (processed images, CSS) - invalidates only when assets/config change
- uses: actions/cache@v4
with:
path: resources/
key: ${{ runner.os }}-hugo-resources-${{ hashFiles('assets/**/*', 'config/**/*', 'hugo.yaml', 'package.json') }}
restore-keys: |
${{ runner.os }}-hugo-resources-
- name: Setup Pages
id: pages
@@ -79,7 +88,7 @@ jobs:
- name: Generate Pagefind search index (if applicable)
run: |
# Check if site uses Pagefind
# Check if site uses Pagefind search
if [ -f "package.json" ] && grep -q "pagefind" package.json; then
pnpm dlx pagefind --source "public" || npx pagefind --source "public"
elif [ -f "netlify.toml" ] && grep -q "pagefind" netlify.toml; then
@@ -94,11 +103,16 @@ jobs:
# Deploy website to GitHub Pages hosting
deploy:
if: github.repository_owner != 'HugoBlox'
needs: build
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
+77
View File
@@ -0,0 +1,77 @@
# ============================================================================
# Hugo Site .gitignore
# ============================================================================
# ============================================================================
# Hugo Build Artifacts
# ============================================================================
# Generated site output
public/
# Hugo resources (processed assets)
resources/
# Hugo build lock
.hugo_build.lock
# Hugo stats
hugo_stats.json
# Auto-generated JS config
**/assets/jsconfig.json
# ============================================================================
# Node.js & Package Managers
# ============================================================================
# Dependencies
node_modules/
# ============================================================================
# Environment & Configuration
# ============================================================================
# Environment variables
.env
.env.local
.env.*.local
# ============================================================================
# Development Tools
# ============================================================================
# IDE & Editors
.vscode/
.idea/
# ============================================================================
# Generated Content
# ============================================================================
# Pagefind search index
pagefind/
static/pagefind/
# ============================================================================
# Operating System
# ============================================================================
# macOS
.DS_Store
.DS_Store?
._*
# Windows
Thumbs.db
Desktop.ini
# Linux
*~
# ============================================================================
# Logs & Temporary Files
# ============================================================================
*.log
npm-debug.log*
+19 -5
View File
@@ -8,7 +8,7 @@ on:
# Trigger the workflow every time you push to the `main` branch
push:
branches: ['main']
# Allows you to run this workflow manually from the Actions tab on GitHub.
# Allows you to run this workflow manually from the Actions tab on GitHub
workflow_dispatch:
# Provide permission to clone the repo and deploy it to GitHub Pages
@@ -56,15 +56,24 @@ jobs:
hugo-version: ${{ env.WC_HUGO_VERSION }}
extended: true
# Cache dependencies (Go modules, node_modules) - stable, rarely changes
- uses: actions/cache@v4
with:
path: |
/tmp/hugo_cache_runner/
node_modules/
modules/*/node_modules/
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.mod', '**/package-lock.json', '**/pnpm-lock.yaml') }}
key: ${{ runner.os }}-hugo-deps-${{ hashFiles('**/go.mod', '**/package-lock.json', '**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-hugomod-
${{ runner.os }}-hugo-deps-
# Cache Hugo resources (processed images, CSS) - invalidates only when assets/config change
- uses: actions/cache@v4
with:
path: resources/
key: ${{ runner.os }}-hugo-resources-${{ hashFiles('assets/**/*', 'config/**/*', 'hugo.yaml', 'package.json') }}
restore-keys: |
${{ runner.os }}-hugo-resources-
- name: Setup Pages
id: pages
@@ -79,7 +88,7 @@ jobs:
- name: Generate Pagefind search index (if applicable)
run: |
# Check if site uses Pagefind
# Check if site uses Pagefind search
if [ -f "package.json" ] && grep -q "pagefind" package.json; then
pnpm dlx pagefind --source "public" || npx pagefind --source "public"
elif [ -f "netlify.toml" ] && grep -q "pagefind" netlify.toml; then
@@ -94,11 +103,16 @@ jobs:
# Deploy website to GitHub Pages hosting
deploy:
if: github.repository_owner != 'HugoBlox'
needs: build
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
+77 -1
View File
@@ -1 +1,77 @@
resources/
# ============================================================================
# Hugo Site .gitignore
# ============================================================================
# ============================================================================
# Hugo Build Artifacts
# ============================================================================
# Generated site output
public/
# Hugo resources (processed assets)
resources/
# Hugo build lock
.hugo_build.lock
# Hugo stats
hugo_stats.json
# Auto-generated JS config
**/assets/jsconfig.json
# ============================================================================
# Node.js & Package Managers
# ============================================================================
# Dependencies
node_modules/
# ============================================================================
# Environment & Configuration
# ============================================================================
# Environment variables
.env
.env.local
.env.*.local
# ============================================================================
# Development Tools
# ============================================================================
# IDE & Editors
.vscode/
.idea/
# ============================================================================
# Generated Content
# ============================================================================
# Pagefind search index
pagefind/
static/pagefind/
# ============================================================================
# Operating System
# ============================================================================
# macOS
.DS_Store
.DS_Store?
._*
# Windows
Thumbs.db
Desktop.ini
# Linux
*~
# ============================================================================
# Logs & Temporary Files
# ============================================================================
*.log
npm-debug.log*