mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-13 14:15:47 +00:00
starters: standardise starters dir name to templates
This commit is contained in:
1 parent
20a6f8202e
commit
5f2290d590
280 files changed
+4473
-231
No files matched your search
@@ -9,7 +9,7 @@ on:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "modules/**"
|
||||
- "starters/**"
|
||||
- "templates/**"
|
||||
- "test/**"
|
||||
- "scripts/**"
|
||||
- "package.json"
|
||||
@@ -25,7 +25,7 @@ on:
|
||||
- ready_for_review
|
||||
paths:
|
||||
- "modules/**"
|
||||
- "starters/**"
|
||||
- "templates/**"
|
||||
- "test/**"
|
||||
- "scripts/**"
|
||||
- "package.json"
|
||||
@@ -38,23 +38,23 @@ permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: starters-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
group: templates-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
NODE_VERSION: "22"
|
||||
|
||||
jobs:
|
||||
build-starters:
|
||||
build-templates:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
starter:
|
||||
- name: academic-cv
|
||||
path: starters/academic-cv
|
||||
path: templates/academic-cv
|
||||
- name: landing-page
|
||||
path: starters/landing-page
|
||||
path: templates/landing-page
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -93,13 +93,13 @@ jobs:
|
||||
- name: Activate pnpm from root package.json
|
||||
run: pnpm --version
|
||||
|
||||
- name: Install starter dependencies
|
||||
- name: Install template dependencies
|
||||
working-directory: ${{ matrix.starter.path }}
|
||||
# Don't use --frozen-lockfile as starters have auto-generated package.json with simple deps (Tailwind CLI)
|
||||
# and may not have lock files checked into the repo
|
||||
run: pnpm install
|
||||
|
||||
- name: Read Hugo version from starter
|
||||
- name: Read Hugo version from template
|
||||
id: hugo
|
||||
run: |
|
||||
set -euo pipefail
|
||||
@@ -186,15 +186,15 @@ jobs:
|
||||
node-version: "${{ env.NODE_VERSION }}"
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install starter dependencies
|
||||
working-directory: starters/academic-cv
|
||||
- name: Install template dependencies
|
||||
working-directory: templates/academic-cv
|
||||
run: pnpm install
|
||||
|
||||
- name: Cache Hugo resources (starter)
|
||||
- name: Cache Hugo resources (template)
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: starters/academic-cv/resources/
|
||||
key: ${{ runner.os }}-hugo-resources-academic-latest-${{ hashFiles('starters/academic-cv/assets/**/*', 'starters/academic-cv/config/**/*', 'starters/academic-cv/hugoblox.yaml', 'starters/academic-cv/package.json') }}
|
||||
path: templates/academic-cv/resources/
|
||||
key: ${{ runner.os }}-hugo-resources-academic-latest-${{ hashFiles('templates/academic-cv/assets/**/*', 'templates/academic-cv/config/**/*', 'templates/academic-cv/hugoblox.yaml', 'templates/academic-cv/package.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-hugo-resources-academic-latest-
|
||||
|
||||
@@ -205,7 +205,7 @@ jobs:
|
||||
extended: true
|
||||
|
||||
- name: Build academic-cv (latest)
|
||||
working-directory: starters/academic-cv
|
||||
working-directory: templates/academic-cv
|
||||
run: hugo --minify --panicOnWarning
|
||||
|
||||
smoke-test-min:
|
||||
|
||||
@@ -2,81 +2,81 @@ name: Release - HugoBlox Modules
|
||||
run-name: ${{ github.workflow }} - ${{ github.ref_name }}
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
dry_run:
|
||||
description: "Run without committing/tagging"
|
||||
type: boolean
|
||||
default: true
|
||||
propagate:
|
||||
description: "Propagate dependency bumps to dependents"
|
||||
type: boolean
|
||||
default: true
|
||||
update_starters_to_commits:
|
||||
description: "Update starters to use latest module commits instead of tagged versions"
|
||||
type: boolean
|
||||
default: false
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
dry_run:
|
||||
description: "Run without committing/tagging"
|
||||
type: boolean
|
||||
default: true
|
||||
propagate:
|
||||
description: "Propagate dependency bumps to dependents"
|
||||
type: boolean
|
||||
default: true
|
||||
update_templates_to_commits:
|
||||
description: "Update templates to use latest module commits instead of tagged versions"
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
contents: write
|
||||
|
||||
concurrency:
|
||||
group: release-modules
|
||||
cancel-in-progress: false
|
||||
group: release-modules
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
LOG_LEVEL: INFO
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
LOG_LEVEL: INFO
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.13"
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.13"
|
||||
|
||||
- name: Install Poetry
|
||||
uses: snok/install-poetry@v1
|
||||
with:
|
||||
version: 1.8.3
|
||||
virtualenvs-create: true
|
||||
virtualenvs-in-project: true
|
||||
- name: Install Poetry
|
||||
uses: snok/install-poetry@v1
|
||||
with:
|
||||
version: 1.8.3
|
||||
virtualenvs-create: true
|
||||
virtualenvs-in-project: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
poetry --version
|
||||
poetry install --no-interaction --no-ansi
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
poetry --version
|
||||
poetry install --no-interaction --no-ansi
|
||||
|
||||
- name: Configure Git identity
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
- name: Configure Git identity
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
# Skip plan display when updating starters to commits as it's not relevant for that operation
|
||||
- name: Show plan (dry run)
|
||||
if: ${{ inputs.dry_run && !inputs.update_starters_to_commits }}
|
||||
run: |
|
||||
poetry run python scripts/release_modules.py --print-plan --log-level $LOG_LEVEL
|
||||
# Skip plan display when updating templates to commits as it's not relevant for that operation
|
||||
- name: Show plan (dry run)
|
||||
if: ${{ inputs.dry_run && !inputs.update_templates_to_commits }}
|
||||
run: |
|
||||
poetry run python scripts/release_modules.py --print-plan --log-level $LOG_LEVEL
|
||||
|
||||
# Dedicated step for updating starters to use latest commits instead of tagged versions
|
||||
# Only runs when specifically requested and not in dry run mode
|
||||
- name: Update starters to commits
|
||||
if: ${{ inputs.update_starters_to_commits && !inputs.dry_run }}
|
||||
run: |
|
||||
poetry run python scripts/release_modules.py --yes --update-starters-to-commits --log-level $LOG_LEVEL
|
||||
# Dedicated step for updating templates to use latest commits instead of tagged versions
|
||||
# Only runs when specifically requested and not in dry run mode
|
||||
- name: Update templates to commits
|
||||
if: ${{ inputs.update_templates_to_commits && !inputs.dry_run }}
|
||||
run: |
|
||||
poetry run python scripts/release_modules.py --yes --update-starters-to-commits --log-level $LOG_LEVEL
|
||||
|
||||
# Standard release process - only runs when not in dry run mode and not updating starters to commits
|
||||
# These operations are mutually exclusive - we either do a normal release or update starters to commits
|
||||
- name: Release (commit, tag, push)
|
||||
if: ${{ !inputs.dry_run && !inputs.update_starters_to_commits }}
|
||||
run: |
|
||||
if [ "${{ inputs.propagate }}" = "true" ]; then
|
||||
poetry run python scripts/release_modules.py --yes --propagate --log-level $LOG_LEVEL
|
||||
else
|
||||
poetry run python scripts/release_modules.py --yes --no-propagate --log-level $LOG_LEVEL
|
||||
fi
|
||||
# Standard release process - only runs when not in dry run mode and not updating templates to commits
|
||||
# These operations are mutually exclusive - we either do a normal release or update starters to commits
|
||||
- name: Release (commit, tag, push)
|
||||
if: ${{ !inputs.dry_run && !inputs.update_templates_to_commits }}
|
||||
run: |
|
||||
if [ "${{ inputs.propagate }}" = "true" ]; then
|
||||
poetry run python scripts/release_modules.py --yes --propagate --log-level $LOG_LEVEL
|
||||
else
|
||||
poetry run python scripts/release_modules.py --yes --no-propagate --log-level $LOG_LEVEL
|
||||
fi
|
||||
@@ -2,145 +2,145 @@ name: "Release - Package Splitter"
|
||||
run-name: ${{ github.workflow }} - ${{ github.ref_name }}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
# IMPORTANT: workflows below must match the upstream workflow's `name:` exactly
|
||||
workflow_run:
|
||||
workflows:
|
||||
- Release - HugoBlox Modules
|
||||
types:
|
||||
- completed
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
# IMPORTANT: workflows below must match the upstream workflow's `name:` exactly
|
||||
workflow_run:
|
||||
workflows:
|
||||
- Release - HugoBlox Modules
|
||||
types:
|
||||
- completed
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
|
||||
jobs:
|
||||
determine_changed:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||
has_changes: ${{ steps.set-matrix.outputs.has_changes }}
|
||||
determine_changed:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||
has_changes: ${{ steps.set-matrix.outputs.has_changes }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- id: changed
|
||||
# Only run change detection for push events
|
||||
if: ${{ github.event_name == 'push' }}
|
||||
uses: tj-actions/changed-files@v47
|
||||
with:
|
||||
files: |
|
||||
starters/academic-cv/**
|
||||
starters/resume/**
|
||||
starters/blog/**
|
||||
starters/documentation/**
|
||||
starters/link-in-bio/**
|
||||
starters/landing-page/**
|
||||
dir_names: true
|
||||
dir_names_max_depth: 2
|
||||
dir_names_exclude_current_dir: true
|
||||
- id: changed
|
||||
# Only run change detection for push events
|
||||
if: ${{ github.event_name == 'push' }}
|
||||
uses: tj-actions/changed-files@v47
|
||||
with:
|
||||
files: |
|
||||
templates/academic-cv/**
|
||||
templates/resume/**
|
||||
templates/blog/**
|
||||
templates/documentation/**
|
||||
templates/link-in-bio/**
|
||||
templates/landing-page/**
|
||||
dir_names: true
|
||||
dir_names_max_depth: 2
|
||||
dir_names_exclude_current_dir: true
|
||||
|
||||
# Build dynamic matrix
|
||||
- name: Build dynamic matrix
|
||||
id: set-matrix
|
||||
env:
|
||||
CHANGED_DIRS: ${{ steps.changed.outputs.dir_names || '' }}
|
||||
run: |
|
||||
# Define the full mapping
|
||||
declare -A STARTER_MAP=(
|
||||
["starters/academic-cv"]="theme-academic-cv"
|
||||
["starters/resume"]="theme-resume"
|
||||
["starters/blog"]="theme-blog"
|
||||
["starters/documentation"]="theme-documentation"
|
||||
["starters/link-in-bio"]="theme-link-in-bio"
|
||||
["starters/landing-page"]="theme-landing-page"
|
||||
)
|
||||
# Build dynamic matrix
|
||||
- name: Build dynamic matrix
|
||||
id: set-matrix
|
||||
env:
|
||||
CHANGED_DIRS: ${{ steps.changed.outputs.dir_names || '' }}
|
||||
run: |
|
||||
# Define the full mapping
|
||||
declare -A STARTER_MAP=(
|
||||
["templates/academic-cv"]="theme-academic-cv"
|
||||
["templates/resume"]="theme-resume"
|
||||
["templates/blog"]="theme-blog"
|
||||
["templates/documentation"]="theme-documentation"
|
||||
["templates/link-in-bio"]="theme-link-in-bio"
|
||||
["templates/landing-page"]="theme-landing-page"
|
||||
)
|
||||
|
||||
# For non-push events, always use full matrix
|
||||
if [ "${{ github.event_name }}" != "push" ]; then
|
||||
echo "Using full matrix for ${{ github.event_name }} event"
|
||||
echo "matrix=[{\"local_path\":\"starters/academic-cv\",\"split_repository\":\"theme-academic-cv\"},{\"local_path\":\"starters/resume\",\"split_repository\":\"theme-resume\"},{\"local_path\":\"starters/blog\",\"split_repository\":\"theme-blog\"},{\"local_path\":\"starters/documentation\",\"split_repository\":\"theme-documentation\"},{\"local_path\":\"starters/link-in-bio\",\"split_repository\":\"theme-link-in-bio\"},{\"local_path\":\"starters/landing-page\",\"split_repository\":\"theme-landing-page\"}]" >> "$GITHUB_OUTPUT"
|
||||
echo "has_changes=true" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
# For non-push events, always use full matrix
|
||||
if [ "${{ github.event_name }}" != "push" ]; then
|
||||
echo "Using full matrix for ${{ github.event_name }} event"
|
||||
echo "matrix=[{\"local_path\":\"templates/academic-cv\",\"split_repository\":\"theme-academic-cv\"},{\"local_path\":\"templates/resume\",\"split_repository\":\"theme-resume\"},{\"local_path\":\"templates/blog\",\"split_repository\":\"theme-blog\"},{\"local_path\":\"templates/documentation\",\"split_repository\":\"theme-documentation\"},{\"local_path\":\"templates/link-in-bio\",\"split_repository\":\"theme-link-in-bio\"},{\"local_path\":\"templates/landing-page\",\"split_repository\":\"theme-landing-page\"}]" >> "$GITHUB_OUTPUT"
|
||||
echo "has_changes=true" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Detected starter directories: $CHANGED_DIRS"
|
||||
echo "Detected template directories: $CHANGED_DIRS"
|
||||
|
||||
# If no changes, set empty matrix
|
||||
if [ -z "$CHANGED_DIRS" ]; then
|
||||
echo "No starters changed"
|
||||
echo "matrix=[]" >> "$GITHUB_OUTPUT"
|
||||
echo "has_changes=false" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
# If no changes, set empty matrix
|
||||
if [ -z "$CHANGED_DIRS" ]; then
|
||||
echo "No templates changed"
|
||||
echo "matrix=[]" >> "$GITHUB_OUTPUT"
|
||||
echo "has_changes=false" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Build JSON array for changed starters
|
||||
JSON="["
|
||||
FIRST=true
|
||||
# tj-actions outputs space-separated list
|
||||
for DIR in $CHANGED_DIRS; do
|
||||
# Normalize potential trailing slash
|
||||
DIR="${DIR%/}"
|
||||
# Build JSON array for changed templates
|
||||
JSON="["
|
||||
FIRST=true
|
||||
# tj-actions outputs space-separated list
|
||||
for DIR in $CHANGED_DIRS; do
|
||||
# Normalize potential trailing slash
|
||||
DIR="${DIR%/}"
|
||||
|
||||
# Collapse to the starter root (first two path segments), e.g. starters/landing-page
|
||||
IFS='/' read -r SEG1 SEG2 _ <<< "$DIR"
|
||||
if [[ -n "$SEG1" && -n "$SEG2" ]]; then
|
||||
ROOT="$SEG1/$SEG2"
|
||||
else
|
||||
ROOT="$DIR"
|
||||
fi
|
||||
# Collapse to the template root (first two path segments), e.g. templates/landing-page
|
||||
IFS='/' read -r SEG1 SEG2 _ <<< "$DIR"
|
||||
if [[ -n "$SEG1" && -n "$SEG2" ]]; then
|
||||
ROOT="$SEG1/$SEG2"
|
||||
else
|
||||
ROOT="$DIR"
|
||||
fi
|
||||
|
||||
# Only process if it's a known starter
|
||||
if [[ -n "${STARTER_MAP[$ROOT]}" ]]; then
|
||||
if [ "$FIRST" = true ]; then
|
||||
FIRST=false
|
||||
else
|
||||
JSON+=","
|
||||
fi
|
||||
JSON+="{\"local_path\":\"$ROOT\",\"split_repository\":\"${STARTER_MAP[$ROOT]}\"}"
|
||||
fi
|
||||
done
|
||||
JSON+="]"
|
||||
# Only process if it's a known starter
|
||||
if [[ -n "${STARTER_MAP[$ROOT]}" ]]; then
|
||||
if [ "$FIRST" = true ]; then
|
||||
FIRST=false
|
||||
else
|
||||
JSON+=","
|
||||
fi
|
||||
JSON+="{\"local_path\":\"$ROOT\",\"split_repository\":\"${STARTER_MAP[$ROOT]}\"}"
|
||||
fi
|
||||
done
|
||||
JSON+="]"
|
||||
|
||||
# Check if we actually added any starters
|
||||
if [ "$JSON" = "[]" ]; then
|
||||
echo "No valid starters found in changed directories"
|
||||
echo "matrix=[]" >> "$GITHUB_OUTPUT"
|
||||
echo "has_changes=false" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "matrix=$JSON" >> "$GITHUB_OUTPUT"
|
||||
echo "has_changes=true" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
# Check if we actually added any starters
|
||||
if [ "$JSON" = "[]" ]; then
|
||||
echo "No valid starters found in changed directories"
|
||||
echo "matrix=[]" >> "$GITHUB_OUTPUT"
|
||||
echo "has_changes=false" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "matrix=$JSON" >> "$GITHUB_OUTPUT"
|
||||
echo "has_changes=true" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
packages_split:
|
||||
needs: determine_changed
|
||||
# Run when:
|
||||
# • Event is not workflow_run OR upstream workflow succeeded.
|
||||
# • Event is not push OR at least one starter changed.
|
||||
if: ${{ (github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success') && needs.determine_changed.outputs.has_changes == 'true' }}
|
||||
packages_split:
|
||||
needs: determine_changed
|
||||
# Run when:
|
||||
# • Event is not workflow_run OR upstream workflow succeeded.
|
||||
# • Event is not push OR at least one starter changed.
|
||||
if: ${{ (github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success') && needs.determine_changed.outputs.has_changes == 'true' }}
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
package: ${{ fromJson(needs.determine_changed.outputs.matrix) }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
package: ${{ fromJson(needs.determine_changed.outputs.matrix) }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# step if no tag is pushed
|
||||
- if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||
uses: "symplify/monorepo-split-github-action@v2.4.0"
|
||||
with:
|
||||
package_directory: "${{ matrix.package.local_path }}"
|
||||
repository_organization: "HugoBlox"
|
||||
repository_name: "${{ matrix.package.split_repository }}"
|
||||
user_name: "Splitter Bot"
|
||||
user_email: "no.reply@hugoblox.com"
|
||||
# step if no tag is pushed
|
||||
- if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||
uses: "symplify/monorepo-split-github-action@v2.4.0"
|
||||
with:
|
||||
package_directory: "${{ matrix.package.local_path }}"
|
||||
repository_organization: "HugoBlox"
|
||||
repository_name: "${{ matrix.package.split_repository }}"
|
||||
user_name: "Splitter Bot"
|
||||
user_email: "no.reply@hugoblox.com"
|
||||
Reference in new issue
Block a user