Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 134 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Build

env:
NODE_VERSION: '20'

on:
# Standalone trigger for PR validation
pull_request:
branches: ['main']
# Reusable workflow trigger - called by deploy.yml
workflow_call:
outputs:
artifact-id:
description: 'The ID of the uploaded artifact'
value: ${{ jobs.build.outputs.artifact-id }}
# Allow manual trigger for testing
workflow_dispatch:

# Read-only permissions for security
permissions:
contents: read

# Prevent duplicate builds for the same PR
concurrency:
group: build-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build:
if: github.repository_owner != 'HugoBlox'
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
artifact-id: ${{ steps.upload.outputs.artifact-id }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Fetch history for Hugo's .GitInfo and .Lastmod
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}

- name: Setup pnpm
if: hashFiles('package.json') != ''
uses: pnpm/action-setup@v4

- name: Get Hugo Version
id: hugo-version
run: |
# Install pinned yq version for robust YAML parsing
YQ_VERSION="v4.44.1"
if ! wget -q --tries=3 --waitretry=1 -O /tmp/yq \
"https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64"; then
echo "::error::Failed to download yq"
exit 1
fi
sudo mv /tmp/yq /usr/local/bin/yq
sudo chmod +x /usr/local/bin/yq

# Read hugo_version from hugoblox.yaml
VERSION=$(yq '.hugo_version // ""' hugoblox.yaml 2>/dev/null | grep -v '^null$' || true)

# Fallback to a known stable version if not specified
DEFAULT_VERSION="0.154.5"
VERSION=${VERSION:-$DEFAULT_VERSION}

# Validate version format (basic check)
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::warning::Invalid hugo_version format '$VERSION', using default $DEFAULT_VERSION"
VERSION="$DEFAULT_VERSION"
fi

echo "HUGO_VERSION=$VERSION" >> $GITHUB_ENV
echo "Using Hugo version: $VERSION"

- name: Install dependencies
run: |
# Install Tailwind CLI if package.json exists
if [ -f "package.json" ]; then
echo "Installing Tailwind dependencies..."
pnpm install --no-frozen-lockfile || npm install
fi

- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: ${{ env.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 }}-hugo-deps-${{ hashFiles('**/go.mod', '**/package-lock.json',
'**/pnpm-lock.yaml') }}
restore-keys: |
${{ 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: Build with Hugo
env:
HUGO_ENVIRONMENT: production
HUGO_BLOX_LICENSE: ${{ secrets.HUGO_BLOX_LICENSE }}
run: |
echo "Hugo Cache Dir: $(hugo config | grep cachedir)"
hugo --minify

- name: Generate Pagefind search index (if applicable)
run: |
# Check if site uses Pagefind search
if [ -f "package.json" ] && grep -q "pagefind" package.json; then
pnpm run pagefind || npx pagefind --site "public"
fi

- name: Upload artifact
id: upload
uses: actions/upload-pages-artifact@v4
with:
path: ./public
130 changes: 48 additions & 82 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
name: Deploy website to GitHub Pages

env:
WC_HUGO_VERSION: '0.148.2'
NODE_VERSION: '20'

on:
# Trigger the workflow every time you push to the `main` branch
push:
Expand All @@ -22,86 +18,56 @@ concurrency:
cancel-in-progress: false

jobs:
# Build website
build:
# Check deployment configuration
config:
if: github.repository_owner != 'HugoBlox'
runs-on: ubuntu-latest
outputs:
deploy-host: ${{ steps.check.outputs.host }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Fetch history for Hugo's .GitInfo and .Lastmod
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Setup pnpm
if: hashFiles('package.json') != ''
uses: pnpm/action-setup@v4

- name: Install dependencies
run: |
# Install Tailwind CLI if package.json exists
if [ -f "package.json" ]; then
echo "Installing Tailwind dependencies..."
pnpm install || npm install
fi

- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
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 }}-hugo-deps-${{ hashFiles('**/go.mod', '**/package-lock.json', '**/pnpm-lock.yaml') }}
restore-keys: |
${{ 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
uses: actions/configure-pages@v5

- name: Build with Hugo
env:
HUGO_ENVIRONMENT: production
run: |
echo "Hugo Cache Dir: $(hugo config | grep cachedir)"
hugo --minify --baseURL "${{ steps.pages.outputs.base_url }}/"

- name: Generate Pagefind search index (if applicable)
run: |
# 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"
fi

- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: ./public
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: hugoblox.yaml
sparse-checkout-cone-mode: false

- name: Check deploy host
id: check
run: |
# Install pinned yq version for robust YAML parsing
YQ_VERSION="v4.44.1"
if ! wget -q --tries=3 --waitretry=1 -O /tmp/yq \
"https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64"; then
echo "::error::Failed to download yq"
exit 1
fi
sudo mv /tmp/yq /usr/local/bin/yq
sudo chmod +x /usr/local/bin/yq

# Read deploy.host from hugoblox.yaml, default to github-pages
HOST=$(yq '.deploy.host // ""' hugoblox.yaml 2>/dev/null | grep -v '^null$' || true)
HOST=${HOST:-github-pages}

# Validate known hosts
if [[ ! "$HOST" =~ ^(github-pages|netlify|vercel|cloudflare|none)$ ]]; then
echo "::warning::Unknown deploy host '$HOST', defaulting to github-pages"
HOST="github-pages"
fi

echo "host=$HOST" >> $GITHUB_OUTPUT
echo "Deployment target: $HOST"

# Build website using reusable workflow (always runs for CI)
build:
needs: config
if: github.repository_owner != 'HugoBlox'
uses: ./.github/workflows/build.yml
secrets: inherit

# Deploy website to GitHub Pages hosting
# Deploy website to GitHub Pages hosting (only if configured)
deploy:
if: github.repository_owner != 'HugoBlox'
needs: build
needs: [config, build]
if: needs.config.outputs.deploy-host == 'github-pages'
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
Expand All @@ -112,6 +78,6 @@ jobs:
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,6 @@ Desktop.ini
# ============================================================================

*.log
npm-debug.log*
npm-debug.log*

content/events.backup
14 changes: 14 additions & 0 deletions content/events.backup/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
# title: Recent Oral and Poster Presentations
title: Recent Oral & Poster Presentations
cms_exclude: true
#url: talk

# View
view: card

# Optional cover image (relative to `assets/media/` folder).
image:
caption: ''
filename: ''
---
Binary file added content/events.backup/example/featured.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
73 changes: 73 additions & 0 deletions content/events.backup/example/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
title: Example Talk

event: Hugo Blox Builder Conference
event_url: https://example.org

location: Hugo Blox Builder HQ
address:
street: 450 Serra Mall
city: Stanford
region: CA
postcode: '94305'
country: United States

summary: An example talk using Hugo Blox Builder's Markdown slides feature.
abstract: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis posuere tellusac convallis placerat. Proin tincidunt magna sed ex sollicitudin condimentum. Sed ac faucibus dolor, scelerisque sollicitudin nisi. Cras purus urna, suscipit quis sapien eu, pulvinar tempor diam.'

# Talk start and end times.
# End time can optionally be hidden by prefixing the line with `#`.
date: '2030-06-01T13:00:00Z'
date_end: '2030-06-01T15:00:00Z'
all_day: false

# Schedule page publish date (NOT talk date).
publishDate: '2017-01-01T00:00:00Z'

authors:
- admin

tags: []

# Is this a featured talk? (true/false)
featured: false

image:
caption: 'Image credit: [**Unsplash**](https://unsplash.com/photos/bzdhc5b3Bxs)'
focal_point: Right

links:
- type: code
url: https://github.com
- type: slides
url: https://slideshare.net
- type: video
url: https://youtube.com

# Markdown Slides (optional).
# Associate this talk with Markdown slides.
# Simply enter your slide deck's filename without extension.
# E.g. `slides = "example-slides"` references `content/slides/example-slides.md`.
# Otherwise, set `slides = ""`.
slides: ""

# Projects (optional).
# Associate this post with one or more of your projects.
# Simply enter your project's folder or file name without extension.
# E.g. `projects = ["internal-project"]` references `content/project/deep-learning/index.md`.
# Otherwise, set `projects = []`.
projects:
- example
---

{{% callout note %}}
Click on the **Slides** button above to view the built-in slides feature.
{{% /callout %}}

Slides can be added in a few ways:

- **Create** slides using Hugo Blox Builder's [_Slides_](https://docs.hugoblox.com/reference/content-types/) feature and link using the `slides` parameter in the front matter of the talk file
- **Upload** an existing slide deck to this page bundle and link it using `links: [{ type: slides, url: path/to/file } ]` in front matter
- **Embed** your slides (e.g. Google Slides) or presentation video on this page using [shortcodes](https://docs.hugoblox.com/reference/markdown/).

Further event details, including [page elements](https://docs.hugoblox.com/reference/markdown/) such as image galleries, can be added to the body of this page.
Loading