From c5625bd0b7ec6ecf497642c42a6d7991c649e533 Mon Sep 17 00:00:00 2001 From: George Cushen Date: Tue, 16 Sep 2025 22:58:08 +0100 Subject: [PATCH] ci: add --update-starters-to-commits option to release script Add standalone option to update starter templates with latest module commits using Go pseudo-versions instead of creating new release tags. - New functions for commit info extraction and pseudo-version formatting - Updates go.mod files with v0.0.0-YYYYMMDDHHMMSS-abcdefabcdef format - Updates Hugo versions in hugoblox.yaml, netlify.toml, and deploy.yml - Uses deploy.yml workflow filename (GitHub Pages convention) - Supports --dry-run for preview and --yes for execution - Perfect for GitHub UI workflows and development environments Validated with: `poetry run python scripts/release_modules.py --update-starters-to-commits --dry-run --log-level INFO` --- scripts/release_modules.py | 133 +++++++++++++++++- .../academic-cv/.github/workflows/deploy.yml | 124 ++++++++-------- starters/academic-cv/go.mod | 4 +- starters/blog/.github/workflows/deploy.yml | 124 ++++++++-------- starters/blog/go.mod | 4 +- .../.github/workflows/deploy.yml | 124 ++++++++-------- starters/documentation/go.mod | 4 +- .../landing-page/.github/workflows/deploy.yml | 124 ++++++++-------- starters/landing-page/go.mod | 4 +- .../link-in-bio/.github/workflows/deploy.yml | 124 ++++++++-------- starters/link-in-bio/go.mod | 4 +- starters/resume/.github/workflows/deploy.yml | 124 ++++++++-------- starters/resume/go.mod | 4 +- 13 files changed, 520 insertions(+), 381 deletions(-) diff --git a/scripts/release_modules.py b/scripts/release_modules.py index 94cd1585..3902e437 100644 --- a/scripts/release_modules.py +++ b/scripts/release_modules.py @@ -30,6 +30,7 @@ import re import subprocess import sys from dataclasses import dataclass, field +from datetime import datetime import logging from pathlib import Path from typing import Dict, List, Optional, Set, Tuple @@ -72,6 +73,42 @@ def get_latest_hugo_version() -> Optional[str]: return None +def get_module_latest_commit_info(module: Module) -> Optional[Tuple[str, datetime]]: + """Get the latest commit hash and timestamp for a module.""" + try: + # Get latest commit hash for the module directory + res = run_cmd(["git", "log", "-1", "--format=%H %ct", "--", str(module.rel_dir)], cwd=REPO_ROOT) + if not res.stdout.strip(): + return None + + parts = res.stdout.strip().split() + if len(parts) != 2: + return None + + commit_hash = parts[0] + timestamp = datetime.fromtimestamp(int(parts[1])) + return commit_hash, timestamp + except Exception as e: + logging.warning("Failed to get commit info for %s: %s", module.name, e) + return None + + +def format_pseudo_version(commit_hash: str, timestamp: datetime, base_version: str = "v0.0.0") -> str: + """Format a commit hash and timestamp as a Go pseudo-version.""" + # Format: v0.0.0-20060102150405-abcdefabcdef + time_str = timestamp.strftime("%Y%m%d%H%M%S") + short_hash = commit_hash[:12] + return f"{base_version}-{time_str}-{short_hash}" + + +def update_go_mod_require_pseudo_version(go_mod_text: str, dep_module_path: str, pseudo_version: str) -> str: + """Replace exact require line with pseudo-version format.""" + # This handles both versioned requires (v1.2.3) and existing pseudo-versions + pattern_line = rf"(?m)^(\s*{re.escape(dep_module_path)}\s+)(?:v\d+[^\s]*|v\d+\.\d+\.\d+-\d+-[a-f0-9]+)$" + replacement_line = rf"\g<1>{pseudo_version}" + return re.sub(pattern_line, replacement_line, go_mod_text) + + @dataclass class Module: name: str # e.g., blox-tailwind @@ -439,8 +476,8 @@ def update_starters(modules: Dict[str, Module], commit: bool, push: bool) -> Non updated_paths.append(netlify) logging.info("starter %s: netlify.toml HUGO_VERSION -> %s", starter_dir.name, latest_hugo) - # bump publish.yaml env WC_HUGO_VERSION - workflow = starter_dir / ".github" / "workflows" / "publish.yaml" + # bump deploy.yml env WC_HUGO_VERSION + workflow = starter_dir / ".github" / "workflows" / "deploy.yml" if latest_hugo and workflow.exists(): with workflow.open("r", encoding="utf-8") as f: wf = yaml.load(f) or {} @@ -449,12 +486,92 @@ def update_starters(modules: Dict[str, Module], commit: bool, push: bool) -> Non with workflow.open("w", encoding="utf-8") as f: yaml.dump(wf, f) updated_paths.append(workflow) - logging.info("starter %s: publish.yaml WC_HUGO_VERSION -> %s", starter_dir.name, latest_hugo) + logging.info("starter %s: deploy.yml WC_HUGO_VERSION -> %s", starter_dir.name, latest_hugo) if updated_paths: stage_and_maybe_commit(updated_paths, "chore(starters): bump modules and Hugo", commit, push) +def update_starters_to_commits(modules: Dict[str, Module], commit: bool, push: bool) -> None: + """Update starters to use latest commit hashes of modules instead of tagged versions.""" + updated_paths: List[Path] = [] + latest_hugo = get_latest_hugo_version() + yaml = YAML() + yaml.preserve_quotes = True + + # Get commit info for all modules first + module_commit_info: Dict[str, Tuple[str, str]] = {} # module_path -> (pseudo_version, short_description) + for module in modules.values(): + commit_info = get_module_latest_commit_info(module) + if commit_info: + commit_hash, timestamp = commit_info + pseudo_version = format_pseudo_version(commit_hash, timestamp) + short_desc = f"{commit_hash[:7]} ({timestamp.strftime('%Y-%m-%d %H:%M:%S')})" + module_commit_info[module.module_path] = (pseudo_version, short_desc) + logging.info("module %s -> %s (%s)", module.name, pseudo_version, short_desc) + + for starter_dir in sorted([p for p in STARTERS_DIR.glob("*") if p.is_dir()]): + # Update go.mod with commit-based pseudo-versions + go_mod = starter_dir / "go.mod" + if go_mod.exists(): + text = go_mod.read_text(encoding="utf-8") + new_text = text + referenced = _extract_requires_from_go_mod(text) + + for module_path in referenced: + if module_path in modules and module_path in module_commit_info: + pseudo_version, short_desc = module_commit_info[module_path] + new_text = update_go_mod_require_pseudo_version(new_text, module_path, pseudo_version) + logging.info("starter %s: %s -> %s", starter_dir.name, modules[module_path].name, short_desc) + + if new_text != text: + go_mod.write_text(new_text, encoding="utf-8") + updated_paths.append(go_mod) + logging.info("starter %s: updated go.mod to use commit versions", starter_dir.name) + + # bump hugo version in hugoblox.yaml (same as regular update_starters) + hb_yaml = starter_dir / "hugoblox.yaml" + if latest_hugo and hb_yaml.exists(): + with hb_yaml.open("r", encoding="utf-8") as f: + data = yaml.load(f) or {} + if "build" not in data: + data["build"] = {} + if data["build"].get("hugo_version") != latest_hugo: + data["build"]["hugo_version"] = SingleQuotedScalarString(latest_hugo) + with hb_yaml.open("w", encoding="utf-8") as f: + yaml.dump(data, f) + updated_paths.append(hb_yaml) + logging.info("starter %s: hugoblox.yaml hugo_version -> %s", starter_dir.name, latest_hugo) + + # bump netlify.toml HUGO_VERSION (same as regular update_starters) + netlify = starter_dir / "netlify.toml" + if latest_hugo and netlify.exists(): + parsed = tomlkit.parse(netlify.read_text(encoding="utf-8")) + if "build" in parsed and "environment" in parsed["build"]: + env = parsed["build"]["environment"] + if env.get("HUGO_VERSION") != latest_hugo: + env["HUGO_VERSION"] = latest_hugo + netlify.write_text(tomlkit.dumps(parsed), encoding="utf-8") + updated_paths.append(netlify) + logging.info("starter %s: netlify.toml HUGO_VERSION -> %s", starter_dir.name, latest_hugo) + + # bump deploy.yml env WC_HUGO_VERSION (same as regular update_starters) + workflow = starter_dir / ".github" / "workflows" / "deploy.yml" + if latest_hugo and workflow.exists(): + with workflow.open("r", encoding="utf-8") as f: + wf = yaml.load(f) or {} + if "env" in wf and wf["env"].get("WC_HUGO_VERSION") != latest_hugo: + wf["env"]["WC_HUGO_VERSION"] = latest_hugo + with workflow.open("w", encoding="utf-8") as f: + yaml.dump(wf, f) + updated_paths.append(workflow) + logging.info("starter %s: deploy.yml WC_HUGO_VERSION -> %s", starter_dir.name, latest_hugo) + + if updated_paths: + stage_and_maybe_commit(updated_paths, "chore(starters): update modules to latest commits", commit, push) + logging.info("Updated %d starter files to use latest module commits", len(updated_paths)) + + def ensure_clean_worktree() -> None: res = run_cmd(["git", "status", "--porcelain"], cwd=REPO_ROOT) dirty = [l for l in res.stdout.splitlines() if l.strip()] @@ -471,6 +588,7 @@ def main() -> None: parser.add_argument("--no-propagate", dest="propagate", action="store_false", help="Do not bump dependents purely for dependency updates.") parser.add_argument("--allow-major", action="store_true", help="Allow major version bumps when inferred from commits. By default majors are downgraded to minor to avoid Go module path changes.") parser.add_argument("--print-plan", action="store_true", help="Print the planned releases as JSON.") + parser.add_argument("--update-starters-to-commits", action="store_true", help="Update starters to use latest module commits instead of releasing new tags. This is a standalone operation that doesn't create releases.") parser.add_argument("--log-level", default=os.getenv("LOG_LEVEL", "INFO"), help="Logging level: DEBUG, INFO, WARNING, ERROR") args = parser.parse_args() @@ -485,6 +603,15 @@ def main() -> None: modules = discover_modules() order = topological_order(modules) + # Handle the standalone --update-starters-to-commits option + if args.update_starters_to_commits: + if yes: + ensure_clean_worktree() + logging.info("Updating starters to use latest module commits...") + update_starters_to_commits(modules, commit=yes, push=yes) + logging.info("Starter update to commits complete") + return + if yes: ensure_clean_worktree() diff --git a/starters/academic-cv/.github/workflows/deploy.yml b/starters/academic-cv/.github/workflows/deploy.yml index a8d26114..c7702c98 100644 --- a/starters/academic-cv/.github/workflows/deploy.yml +++ b/starters/academic-cv/.github/workflows/deploy.yml @@ -1,7 +1,7 @@ name: Deploy website to GitHub Pages env: - WC_HUGO_VERSION: '0.148.2' + WC_HUGO_VERSION: '0.150.0' NODE_VERSION: '20' on: @@ -27,76 +27,78 @@ jobs: if: github.repository_owner != 'HugoBlox' runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - with: + - name: Checkout + uses: actions/checkout@v4 + with: # Fetch history for Hugo's .GitInfo and .Lastmod - fetch-depth: 0 + fetch-depth: 0 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} + - 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: 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: 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 + - 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- + - 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- + - 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: 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: 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: 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: Upload artifact + uses: actions/upload-pages-artifact@v4 + with: + path: ./public # Deploy website to GitHub Pages hosting deploy: @@ -112,6 +114,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 diff --git a/starters/academic-cv/go.mod b/starters/academic-cv/go.mod index da3203ff..2892786a 100644 --- a/starters/academic-cv/go.mod +++ b/starters/academic-cv/go.mod @@ -3,6 +3,6 @@ module github.com/HugoBlox/hugo-blox-builder/starters/academic-cv go 1.19 require ( - github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-netlify v1.1.2 - github.com/HugoBlox/hugo-blox-builder/modules/blox-tailwind v0.7.0 + github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-netlify v0.0.0-20231109145828-d9695efa098f + github.com/HugoBlox/hugo-blox-builder/modules/blox-tailwind v0.0.0-20250907230443-1675dd45f046 ) diff --git a/starters/blog/.github/workflows/deploy.yml b/starters/blog/.github/workflows/deploy.yml index a8d26114..c7702c98 100644 --- a/starters/blog/.github/workflows/deploy.yml +++ b/starters/blog/.github/workflows/deploy.yml @@ -1,7 +1,7 @@ name: Deploy website to GitHub Pages env: - WC_HUGO_VERSION: '0.148.2' + WC_HUGO_VERSION: '0.150.0' NODE_VERSION: '20' on: @@ -27,76 +27,78 @@ jobs: if: github.repository_owner != 'HugoBlox' runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - with: + - name: Checkout + uses: actions/checkout@v4 + with: # Fetch history for Hugo's .GitInfo and .Lastmod - fetch-depth: 0 + fetch-depth: 0 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} + - 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: 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: 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 + - 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- + - 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- + - 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: 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: 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: 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: Upload artifact + uses: actions/upload-pages-artifact@v4 + with: + path: ./public # Deploy website to GitHub Pages hosting deploy: @@ -112,6 +114,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 diff --git a/starters/blog/go.mod b/starters/blog/go.mod index 1f4f73bb..a9a5f3aa 100644 --- a/starters/blog/go.mod +++ b/starters/blog/go.mod @@ -3,6 +3,6 @@ module github.com/HugoBlox/hugo-blox-builder/starters/blog go 1.19 require ( - github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-netlify v1.1.2 - github.com/HugoBlox/hugo-blox-builder/modules/blox-tailwind v0.7.0 + github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-netlify v0.0.0-20231109145828-d9695efa098f + github.com/HugoBlox/hugo-blox-builder/modules/blox-tailwind v0.0.0-20250907230443-1675dd45f046 ) diff --git a/starters/documentation/.github/workflows/deploy.yml b/starters/documentation/.github/workflows/deploy.yml index a8d26114..c7702c98 100644 --- a/starters/documentation/.github/workflows/deploy.yml +++ b/starters/documentation/.github/workflows/deploy.yml @@ -1,7 +1,7 @@ name: Deploy website to GitHub Pages env: - WC_HUGO_VERSION: '0.148.2' + WC_HUGO_VERSION: '0.150.0' NODE_VERSION: '20' on: @@ -27,76 +27,78 @@ jobs: if: github.repository_owner != 'HugoBlox' runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - with: + - name: Checkout + uses: actions/checkout@v4 + with: # Fetch history for Hugo's .GitInfo and .Lastmod - fetch-depth: 0 + fetch-depth: 0 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} + - 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: 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: 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 + - 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- + - 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- + - 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: 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: 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: 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: Upload artifact + uses: actions/upload-pages-artifact@v4 + with: + path: ./public # Deploy website to GitHub Pages hosting deploy: @@ -112,6 +114,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 diff --git a/starters/documentation/go.mod b/starters/documentation/go.mod index 739d91d1..7077c4ae 100644 --- a/starters/documentation/go.mod +++ b/starters/documentation/go.mod @@ -3,6 +3,6 @@ module github.com/HugoBlox/theme-documentation go 1.15 require ( - github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-netlify v1.1.2 - github.com/HugoBlox/hugo-blox-builder/modules/blox-tailwind v0.7.0 + github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-netlify v0.0.0-20231109145828-d9695efa098f + github.com/HugoBlox/hugo-blox-builder/modules/blox-tailwind v0.0.0-20250907230443-1675dd45f046 ) diff --git a/starters/landing-page/.github/workflows/deploy.yml b/starters/landing-page/.github/workflows/deploy.yml index a8d26114..c7702c98 100644 --- a/starters/landing-page/.github/workflows/deploy.yml +++ b/starters/landing-page/.github/workflows/deploy.yml @@ -1,7 +1,7 @@ name: Deploy website to GitHub Pages env: - WC_HUGO_VERSION: '0.148.2' + WC_HUGO_VERSION: '0.150.0' NODE_VERSION: '20' on: @@ -27,76 +27,78 @@ jobs: if: github.repository_owner != 'HugoBlox' runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - with: + - name: Checkout + uses: actions/checkout@v4 + with: # Fetch history for Hugo's .GitInfo and .Lastmod - fetch-depth: 0 + fetch-depth: 0 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} + - 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: 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: 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 + - 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- + - 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- + - 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: 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: 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: 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: Upload artifact + uses: actions/upload-pages-artifact@v4 + with: + path: ./public # Deploy website to GitHub Pages hosting deploy: @@ -112,6 +114,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 diff --git a/starters/landing-page/go.mod b/starters/landing-page/go.mod index 9da11f92..e98ca3d9 100644 --- a/starters/landing-page/go.mod +++ b/starters/landing-page/go.mod @@ -3,6 +3,6 @@ module github.com/HugoBlox/theme-landing-page go 1.19 require ( - github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-netlify v1.1.2 - github.com/HugoBlox/hugo-blox-builder/modules/blox-tailwind v0.7.0 + github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-netlify v0.0.0-20231109145828-d9695efa098f + github.com/HugoBlox/hugo-blox-builder/modules/blox-tailwind v0.0.0-20250907230443-1675dd45f046 ) diff --git a/starters/link-in-bio/.github/workflows/deploy.yml b/starters/link-in-bio/.github/workflows/deploy.yml index a8d26114..c7702c98 100644 --- a/starters/link-in-bio/.github/workflows/deploy.yml +++ b/starters/link-in-bio/.github/workflows/deploy.yml @@ -1,7 +1,7 @@ name: Deploy website to GitHub Pages env: - WC_HUGO_VERSION: '0.148.2' + WC_HUGO_VERSION: '0.150.0' NODE_VERSION: '20' on: @@ -27,76 +27,78 @@ jobs: if: github.repository_owner != 'HugoBlox' runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - with: + - name: Checkout + uses: actions/checkout@v4 + with: # Fetch history for Hugo's .GitInfo and .Lastmod - fetch-depth: 0 + fetch-depth: 0 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} + - 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: 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: 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 + - 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- + - 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- + - 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: 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: 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: 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: Upload artifact + uses: actions/upload-pages-artifact@v4 + with: + path: ./public # Deploy website to GitHub Pages hosting deploy: @@ -112,6 +114,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 diff --git a/starters/link-in-bio/go.mod b/starters/link-in-bio/go.mod index 9ccd4ab1..303e753e 100644 --- a/starters/link-in-bio/go.mod +++ b/starters/link-in-bio/go.mod @@ -3,6 +3,6 @@ module my_website go 1.19 require ( - github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-netlify v1.1.2 - github.com/HugoBlox/hugo-blox-builder/modules/blox-tailwind v0.7.0 + github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-netlify v0.0.0-20231109145828-d9695efa098f + github.com/HugoBlox/hugo-blox-builder/modules/blox-tailwind v0.0.0-20250907230443-1675dd45f046 ) diff --git a/starters/resume/.github/workflows/deploy.yml b/starters/resume/.github/workflows/deploy.yml index a8d26114..c7702c98 100644 --- a/starters/resume/.github/workflows/deploy.yml +++ b/starters/resume/.github/workflows/deploy.yml @@ -1,7 +1,7 @@ name: Deploy website to GitHub Pages env: - WC_HUGO_VERSION: '0.148.2' + WC_HUGO_VERSION: '0.150.0' NODE_VERSION: '20' on: @@ -27,76 +27,78 @@ jobs: if: github.repository_owner != 'HugoBlox' runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - with: + - name: Checkout + uses: actions/checkout@v4 + with: # Fetch history for Hugo's .GitInfo and .Lastmod - fetch-depth: 0 + fetch-depth: 0 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} + - 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: 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: 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 + - 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- + - 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- + - 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: 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: 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: 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: Upload artifact + uses: actions/upload-pages-artifact@v4 + with: + path: ./public # Deploy website to GitHub Pages hosting deploy: @@ -112,6 +114,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 diff --git a/starters/resume/go.mod b/starters/resume/go.mod index 1f4f73bb..a9a5f3aa 100644 --- a/starters/resume/go.mod +++ b/starters/resume/go.mod @@ -3,6 +3,6 @@ module github.com/HugoBlox/hugo-blox-builder/starters/blog go 1.19 require ( - github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-netlify v1.1.2 - github.com/HugoBlox/hugo-blox-builder/modules/blox-tailwind v0.7.0 + github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-netlify v0.0.0-20231109145828-d9695efa098f + github.com/HugoBlox/hugo-blox-builder/modules/blox-tailwind v0.0.0-20250907230443-1675dd45f046 )