From 78a1731c3632ebbac0f3977108a8004c623b6fcd Mon Sep 17 00:00:00 2001 From: Drew Kennedy Date: Tue, 10 Jun 2025 16:37:04 +1000 Subject: [PATCH 01/17] Remove current location placeholder from About page --- about.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/about.md b/about.md index 71b079d..220f3f3 100644 --- a/about.md +++ b/about.md @@ -28,6 +28,4 @@ Feel free to connect with me: - **GitHub**: [github.com/devnomadic](https://github.com/devnomadic) - **Email**: hello@devnomadic.com ---- - -*Currently coding from: [Current Location]* +--- \ No newline at end of file From eb4c4a280f279633d3c9d282b099573f2ba6c04c Mon Sep 17 00:00:00 2001 From: Drew Kennedy Date: Tue, 10 Jun 2025 17:03:14 +1000 Subject: [PATCH 02/17] Fix 404.html with Jekyll front matter and SPA redirect workaround --- 404.html | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/404.html b/404.html index e69de29..56bd752 100644 --- a/404.html +++ b/404.html @@ -0,0 +1,39 @@ +--- +permalink: /404.html +layout: default +--- + + + +
+

404

+ +

Page not found :(

+

The requested page could not be found.

+ + +
\ No newline at end of file From 54b7ea98ff790656c041afa215ad42c9610b811d Mon Sep 17 00:00:00 2001 From: Drew Kennedy Date: Tue, 10 Jun 2025 17:45:38 +1000 Subject: [PATCH 03/17] Add staging directory for preview posts - Created staging/ directory for preview-only posts - Added _config_preview.yml to include staging posts in builds - Updated preview workflow to copy modified posts to staging - Posts are staged during PR preview, moved to _posts/ after merge --- .github/workflows/preview.yml | 22 +++++++++++++++++++++- _config_preview.yml | 20 ++++++++++++++++++++ staging/README.md | 13 +++++++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 _config_preview.yml create mode 100644 staging/README.md diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 810520f..342d067 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -27,12 +27,32 @@ jobs: ruby-version: '3.1' bundler-cache: true + - name: Setup staging for preview + if: github.event.action != 'closed' + run: | + # Copy any new or modified post files to staging directory + # This allows preview of posts before they go live + mkdir -p staging + + # Find modified .md files in _posts directory from this PR + git diff --name-only origin/main...HEAD | grep "^_posts/.*\.md$" | while read file; do + if [ -f "$file" ]; then + echo "Staging post: $file" + cp "$file" "staging/$(basename "$file")" + fi + done + + # List staged files for debugging + echo "Staged posts:" + ls -la staging/ || echo "No posts staged" + - name: Build Jekyll site if: github.event.action != 'closed' run: | # Remove CNAME file for previews to avoid routing conflicts rm -f CNAME - bundle exec jekyll build + # Build with preview config that includes staging posts + bundle exec jekyll build --config _config.yml,_config_preview.yml env: JEKYLL_ENV: production diff --git a/_config_preview.yml b/_config_preview.yml new file mode 100644 index 0000000..9103d2a --- /dev/null +++ b/_config_preview.yml @@ -0,0 +1,20 @@ +# Preview-specific configuration +# This extends the main _config.yml for preview builds + +# Collections for staging posts +collections: + staging: + output: true + permalink: /:collection/:name/ + +# Make staging posts appear in site.posts +defaults: + - scope: + path: "staging" + type: "staging" + values: + layout: "post" + +# Include staging directory in the build +include: + - staging diff --git a/staging/README.md b/staging/README.md new file mode 100644 index 0000000..a0e4215 --- /dev/null +++ b/staging/README.md @@ -0,0 +1,13 @@ +# Staging Directory + +This directory contains markdown post files that are being staged for preview before publication. + +## Structure: +- `staging/` - Contains draft/preview post files +- `_posts/` - Contains published post files + +## Workflow: +1. During preview builds, new post `.md` files are copied here +2. Jekyll builds the site with both `_posts/` and `staging/` content +3. After review and approval, posts are moved from `staging/` to `_posts/` +4. Staging directory is cleaned up after merge From c3ea52bc6874e10ff7e143000165d1cf0c36d259 Mon Sep 17 00:00:00 2001 From: Drew Kennedy Date: Tue, 10 Jun 2025 18:08:23 +1000 Subject: [PATCH 04/17] Refactor staging deployment workflow and add staging area page for preview posts --- .github/workflows/preview.yml | 172 +++++++++++++++++++++++++++------- staging/index.md | 98 +++++++++++++++++++ 2 files changed, 238 insertions(+), 32 deletions(-) create mode 100644 staging/index.md diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 342d067..d9566d0 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -1,21 +1,24 @@ -name: Deploy PR Preview +name: Deploy Staging Preview on: - pull_request: - types: - - opened - - reopened - - synchronize - - closed + push: + branches: [post/updates] # Build staging when changes pushed to updates branch + paths: + - '_posts/**' + - 'staging/**' + - '_config*.yml' + - '_layouts/**' + - '_includes/**' + - 'assets/**' + workflow_dispatch: # Allow manual trigger permissions: contents: write - pull-requests: write -concurrency: preview-${{ github.ref }} +concurrency: staging-preview jobs: - deploy-preview: + deploy-staging: runs-on: ubuntu-latest steps: - name: Checkout @@ -27,38 +30,143 @@ jobs: ruby-version: '3.1' bundler-cache: true - - name: Setup staging for preview - if: github.event.action != 'closed' + - name: Setup staging posts run: | - # Copy any new or modified post files to staging directory - # This allows preview of posts before they go live + echo "=== Setting up staging posts ===" + + # Ensure staging directory exists mkdir -p staging - # Find modified .md files in _posts directory from this PR - git diff --name-only origin/main...HEAD | grep "^_posts/.*\.md$" | while read file; do - if [ -f "$file" ]; then - echo "Staging post: $file" - cp "$file" "staging/$(basename "$file")" - fi - done + # Find new or modified .md files in _posts directory + echo "Checking for new/modified posts to stage..." + + # Get posts that are new or modified compared to main branch + if git rev-parse origin/main >/dev/null 2>&1; then + echo "Comparing with main branch..." + MODIFIED_POSTS=$(git diff --name-only origin/main...HEAD | grep "^_posts/.*\.md$" || true) + else + echo "Main branch not found, staging all posts..." + MODIFIED_POSTS=$(find _posts -name "*.md" 2>/dev/null || true) + fi - # List staged files for debugging + if [ -n "$MODIFIED_POSTS" ]; then + echo "Posts to stage:" + echo "$MODIFIED_POSTS" | while read -r file; do + if [ -f "$file" ]; then + echo " - Staging: $file" + cp "$file" "staging/$(basename "$file")" + fi + done + else + echo "No new/modified posts found to stage" + fi + + # Show current staging content + echo "=== Current staging content ===" echo "Staged posts:" - ls -la staging/ || echo "No posts staged" + find staging/ -name "*.md" -not -name "README.md" -not -name "index.md" | sort || echo " (none)" + + echo "Published posts:" + ls -1 _posts/*.md 2>/dev/null | head -5 || echo " (none)" - - name: Build Jekyll site - if: github.event.action != 'closed' + - name: Build Jekyll site with staging run: | + echo "=== Building Jekyll site with staging ===" + # Remove CNAME file for previews to avoid routing conflicts rm -f CNAME - # Build with preview config that includes staging posts + + # Build Jekyll site - staging posts will be included as a collection bundle exec jekyll build --config _config.yml,_config_preview.yml + + echo "Build completed. Site structure:" + find _site -name "*.html" | head -10 env: JEKYLL_ENV: production - - name: Deploy preview - uses: rossjrw/pr-preview-action@v1 - with: - source-dir: ./_site - preview-branch: gh-pages - umbrella-dir: pr-preview + - name: Deploy to staging area + run: | + echo "=== Deploying to staging area ===" + + # Switch to gh-pages branch + git fetch origin gh-pages:gh-pages || git checkout --orphan gh-pages + git checkout gh-pages + + # Clear old staging content and copy new build + rm -rf staging/ + mkdir -p staging/ + + # Copy built site to staging directory + cp -r _site/* staging/ + + # Create a clear staging landing page + cat > staging-info.html << 'EOF' + + + + Staging Area - devnomadic + + + + + +
🚧 STAGING
+ +

Staging Area

+

This is the staging area for preview posts and content before they go live on the main site.

+ + + +
+

What's Here

+

• Staged posts that are ready for preview

+

• Draft content being reviewed

+

• Updated layouts and styling

+
+ +
+

Latest build: $(date -u)

+

Branch: ${{ github.ref_name }}

+

Commit: ${{ github.sha }}

+
+ + + EOF + + # Add staging info to root of staging area + mv staging-info.html staging/ + + # Commit and push + git add staging/ + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + git commit -m "Deploy staging preview from ${{ github.ref_name }} (${{ github.sha }})" || exit 0 + git push origin gh-pages + + echo "=== Staging deployment complete ===" + echo "Preview URL: https://devnomadic.github.io/staging/" diff --git a/staging/index.md b/staging/index.md new file mode 100644 index 0000000..21073ce --- /dev/null +++ b/staging/index.md @@ -0,0 +1,98 @@ +--- +layout: default +title: Staging Area +permalink: /staging/ +--- + +# 🚧 Staging Area + +This is where posts are staged for preview before going live. + +
+ STAGING + Preview posts appear here before publication +
+ +## Staged Posts + +
+ {% assign staging_posts = site.staging | sort: 'date' | reverse %} + {% if staging_posts.size > 0 %} + {% for post in staging_posts %} +
+ {{ post.title }} + +
+ {% endfor %} + {% else %} +

No posts currently staged for preview.

+ {% endif %} +
+ +## Navigation + +- [← Back to main site](/) +- [About](/about/) +- [Archive](/archive/) + + From 2400c019522f5631fa35ba134108a0510050899e Mon Sep 17 00:00:00 2001 From: Drew Kennedy Date: Tue, 10 Jun 2025 18:16:29 +1000 Subject: [PATCH 05/17] Refactor staging deployment to clear old content and deploy full site to root --- .github/workflows/preview.yml | 82 +++++------------------------------ 1 file changed, 10 insertions(+), 72 deletions(-) diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index d9566d0..ee4fa60 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -84,89 +84,27 @@ jobs: env: JEKYLL_ENV: production - - name: Deploy to staging area + - name: Deploy staging site run: | - echo "=== Deploying to staging area ===" + echo "=== Deploying staging site ===" # Switch to gh-pages branch git fetch origin gh-pages:gh-pages || git checkout --orphan gh-pages git checkout gh-pages - # Clear old staging content and copy new build - rm -rf staging/ - mkdir -p staging/ + # Clear all content and deploy full site to root + rm -rf * + rm -rf .*/ 2>/dev/null || true - # Copy built site to staging directory - cp -r _site/* staging/ + # Copy built site to root of gh-pages + cp -r _site/* ./ - # Create a clear staging landing page - cat > staging-info.html << 'EOF' - - - - Staging Area - devnomadic - - - - - -
🚧 STAGING
- -

Staging Area

-

This is the staging area for preview posts and content before they go live on the main site.

- - - -
-

What's Here

-

• Staged posts that are ready for preview

-

• Draft content being reviewed

-

• Updated layouts and styling

-
- -
-

Latest build: $(date -u)

-

Branch: ${{ github.ref_name }}

-

Commit: ${{ github.sha }}

-
- - - EOF - - # Add staging info to root of staging area - mv staging-info.html staging/ - - # Commit and push - git add staging/ + # Commit and push the full staging site + git add -A git config user.name "GitHub Actions" git config user.email "actions@github.com" git commit -m "Deploy staging preview from ${{ github.ref_name }} (${{ github.sha }})" || exit 0 git push origin gh-pages echo "=== Staging deployment complete ===" - echo "Preview URL: https://devnomadic.github.io/staging/" + echo "Preview URL: https://devnomadic.github.io/" From 07fcf5ddda4ee825c14db0f6940e9f228022cae2 Mon Sep 17 00:00:00 2001 From: Drew Kennedy Date: Tue, 10 Jun 2025 18:20:49 +1000 Subject: [PATCH 06/17] Remove test deployment and preview files --- test-deployment-albatross.txt | 1 - test-preview.txt | 1 - 2 files changed, 2 deletions(-) delete mode 100644 test-deployment-albatross.txt delete mode 100644 test-preview.txt diff --git a/test-deployment-albatross.txt b/test-deployment-albatross.txt deleted file mode 100644 index 8fdd2ad..0000000 --- a/test-deployment-albatross.txt +++ /dev/null @@ -1 +0,0 @@ -Test deployment albatross - Tue Jun 10 16:14:29 AEST 2025 diff --git a/test-preview.txt b/test-preview.txt deleted file mode 100644 index d3ea678..0000000 --- a/test-preview.txt +++ /dev/null @@ -1 +0,0 @@ -Testing PR preview functionality From 33a31579fe0a504a10e1562d7de8be369954b758 Mon Sep 17 00:00:00 2001 From: Drew Kennedy Date: Tue, 10 Jun 2025 18:23:32 +1000 Subject: [PATCH 07/17] Update staging README to clarify workflow --- staging/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/staging/README.md b/staging/README.md index a0e4215..c50b016 100644 --- a/staging/README.md +++ b/staging/README.md @@ -3,11 +3,13 @@ This directory contains markdown post files that are being staged for preview before publication. ## Structure: -- `staging/` - Contains draft/preview post files +- `staging/` - Contains draft/preview post files - `_posts/` - Contains published post files ## Workflow: -1. During preview builds, new post `.md` files are copied here +1. During preview builds, new/modified post `.md` files are automatically copied here +2. Jekyll builds the full site including staged posts +3. Preview site is deployed to GitHub Pages root (not nested) 2. Jekyll builds the site with both `_posts/` and `staging/` content 3. After review and approval, posts are moved from `staging/` to `_posts/` 4. Staging directory is cleaned up after merge From bdd945d6be033b911ae1de98baa55e9586153213 Mon Sep 17 00:00:00 2001 From: Drew Kennedy Date: Tue, 10 Jun 2025 18:25:16 +1000 Subject: [PATCH 08/17] Add verbose logging and error handling to staging workflow --- .github/workflows/preview.yml | 39 +++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index ee4fa60..15f7a5a 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -76,11 +76,34 @@ jobs: # Remove CNAME file for previews to avoid routing conflicts rm -f CNAME + # Show current directory structure before build + echo "Files before build:" + ls -la + # Build Jekyll site - staging posts will be included as a collection - bundle exec jekyll build --config _config.yml,_config_preview.yml + echo "Running Jekyll build..." + bundle exec jekyll build --config _config.yml,_config_preview.yml --verbose - echo "Build completed. Site structure:" - find _site -name "*.html" | head -10 + # Check if build succeeded + if [ $? -eq 0 ]; then + echo "Jekyll build completed successfully" + else + echo "Jekyll build failed!" + exit 1 + fi + + # Show what was built + echo "Build completed. Checking _site directory:" + if [ -d "_site" ]; then + echo "_site directory exists" + echo "Site structure:" + find _site -name "*.html" | head -10 + echo "Total files in _site:" + find _site -type f | wc -l + else + echo "ERROR: _site directory was not created!" + exit 1 + fi env: JEKYLL_ENV: production @@ -88,12 +111,20 @@ jobs: run: | echo "=== Deploying staging site ===" + # Verify _site directory exists before proceeding + if [ ! -d "_site" ]; then + echo "ERROR: _site directory not found. Build must have failed." + exit 1 + fi + + echo "_site directory found, proceeding with deployment..." + # Switch to gh-pages branch git fetch origin gh-pages:gh-pages || git checkout --orphan gh-pages git checkout gh-pages # Clear all content and deploy full site to root - rm -rf * + rm -rf * 2>/dev/null || true rm -rf .*/ 2>/dev/null || true # Copy built site to root of gh-pages From e716cf4681d4baeca20e1fde91950575af8d70ae Mon Sep 17 00:00:00 2001 From: Drew Kennedy Date: Tue, 10 Jun 2025 18:27:11 +1000 Subject: [PATCH 09/17] Force workflow trigger to test improved error handling --- staging/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/staging/README.md b/staging/README.md index c50b016..fe9af28 100644 --- a/staging/README.md +++ b/staging/README.md @@ -10,6 +10,9 @@ This directory contains markdown post files that are being staged for preview be 1. During preview builds, new/modified post `.md` files are automatically copied here 2. Jekyll builds the full site including staged posts 3. Preview site is deployed to GitHub Pages root (not nested) + +## Testing: +Updated to trigger workflow with improved error handling and verbose logging. 2. Jekyll builds the site with both `_posts/` and `staging/` content 3. After review and approval, posts are moved from `staging/` to `_posts/` 4. Staging directory is cleaned up after merge From 055ba2bba363ada5eb570fec21cbc1989eb107e6 Mon Sep 17 00:00:00 2001 From: Drew Kennedy Date: Tue, 10 Jun 2025 18:33:02 +1000 Subject: [PATCH 10/17] Simplify staging workflow: remove copy logic, add test post, trigger on PR --- .github/workflows/preview.yml | 88 ++++--------------------- staging/2025-06-10-test-staging-post.md | 29 ++++++++ 2 files changed, 42 insertions(+), 75 deletions(-) create mode 100644 staging/2025-06-10-test-staging-post.md diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 15f7a5a..5b856db 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -1,15 +1,8 @@ name: Deploy Staging Preview on: - push: - branches: [post/updates] # Build staging when changes pushed to updates branch - paths: - - '_posts/**' - - 'staging/**' - - '_config*.yml' - - '_layouts/**' - - '_includes/**' - - 'assets/**' + pull_request: + types: [opened, synchronize, reopened] workflow_dispatch: # Allow manual trigger permissions: @@ -30,40 +23,10 @@ jobs: ruby-version: '3.1' bundler-cache: true - - name: Setup staging posts + - name: Show staging content run: | - echo "=== Setting up staging posts ===" - - # Ensure staging directory exists - mkdir -p staging - - # Find new or modified .md files in _posts directory - echo "Checking for new/modified posts to stage..." - - # Get posts that are new or modified compared to main branch - if git rev-parse origin/main >/dev/null 2>&1; then - echo "Comparing with main branch..." - MODIFIED_POSTS=$(git diff --name-only origin/main...HEAD | grep "^_posts/.*\.md$" || true) - else - echo "Main branch not found, staging all posts..." - MODIFIED_POSTS=$(find _posts -name "*.md" 2>/dev/null || true) - fi - - if [ -n "$MODIFIED_POSTS" ]; then - echo "Posts to stage:" - echo "$MODIFIED_POSTS" | while read -r file; do - if [ -f "$file" ]; then - echo " - Staging: $file" - cp "$file" "staging/$(basename "$file")" - fi - done - else - echo "No new/modified posts found to stage" - fi - - # Show current staging content - echo "=== Current staging content ===" - echo "Staged posts:" + echo "=== Staging content ===" + echo "Staging posts:" find staging/ -name "*.md" -not -name "README.md" -not -name "index.md" | sort || echo " (none)" echo "Published posts:" @@ -76,34 +39,17 @@ jobs: # Remove CNAME file for previews to avoid routing conflicts rm -f CNAME - # Show current directory structure before build - echo "Files before build:" - ls -la - # Build Jekyll site - staging posts will be included as a collection - echo "Running Jekyll build..." - bundle exec jekyll build --config _config.yml,_config_preview.yml --verbose + bundle exec jekyll build --config _config.yml,_config_preview.yml - # Check if build succeeded - if [ $? -eq 0 ]; then - echo "Jekyll build completed successfully" - else - echo "Jekyll build failed!" + # Verify build succeeded + if [ ! -d "_site" ] || [ -z "$(ls -A _site 2>/dev/null)" ]; then + echo "ERROR: Jekyll build failed or created empty _site directory" exit 1 fi - # Show what was built - echo "Build completed. Checking _site directory:" - if [ -d "_site" ]; then - echo "_site directory exists" - echo "Site structure:" - find _site -name "*.html" | head -10 - echo "Total files in _site:" - find _site -type f | wc -l - else - echo "ERROR: _site directory was not created!" - exit 1 - fi + echo "Build completed successfully" + echo "Files built: $(find _site -type f | wc -l)" env: JEKYLL_ENV: production @@ -111,14 +57,6 @@ jobs: run: | echo "=== Deploying staging site ===" - # Verify _site directory exists before proceeding - if [ ! -d "_site" ]; then - echo "ERROR: _site directory not found. Build must have failed." - exit 1 - fi - - echo "_site directory found, proceeding with deployment..." - # Switch to gh-pages branch git fetch origin gh-pages:gh-pages || git checkout --orphan gh-pages git checkout gh-pages @@ -130,11 +68,11 @@ jobs: # Copy built site to root of gh-pages cp -r _site/* ./ - # Commit and push the full staging site + # Commit and push the staging site git add -A git config user.name "GitHub Actions" git config user.email "actions@github.com" - git commit -m "Deploy staging preview from ${{ github.ref_name }} (${{ github.sha }})" || exit 0 + git commit -m "Deploy staging preview from PR #${{ github.event.number }}" || exit 0 git push origin gh-pages echo "=== Staging deployment complete ===" diff --git a/staging/2025-06-10-test-staging-post.md b/staging/2025-06-10-test-staging-post.md new file mode 100644 index 0000000..ecf4e41 --- /dev/null +++ b/staging/2025-06-10-test-staging-post.md @@ -0,0 +1,29 @@ +--- +layout: post +title: "Test Staging Post" +date: 2025-06-10 12:00:00 -0500 +tags: [test, staging] +--- + +# Test Staging Post + +This is a test post that lives directly in the staging directory. + +## Purpose + +This post is used to test the staging preview system: + +- It's a real blog post with proper front matter +- It lives in the `staging/` directory +- It will be built as part of the staging collection +- It appears in the preview site + +## Content + +This is just sample content to verify that: + +1. Jekyll can build staging posts +2. The staging collection works +3. Posts appear in the preview deployment + +When this works, we know the staging system is functioning correctly! From 3f8003411c1891261a6bb20f4d66e3c48d038148 Mon Sep 17 00:00:00 2001 From: Drew Kennedy Date: Tue, 10 Jun 2025 18:40:19 +1000 Subject: [PATCH 11/17] Add comprehensive debugging to identify Jekyll build issues --- .github/workflows/preview.yml | 36 +++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 5b856db..40aa7d9 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -36,20 +36,40 @@ jobs: run: | echo "=== Building Jekyll site with staging ===" + # Show what files are available to Jekyll + echo "=== Available content ===" + echo "Posts in _posts/:" + ls -la _posts/ 2>/dev/null || echo "No _posts directory" + + echo "Posts in staging/:" + ls -la staging/ 2>/dev/null || echo "No staging directory" + + echo "Index files:" + ls -la *.html *.md 2>/dev/null || echo "No index files" + + # Show Jekyll configs + echo "=== Jekyll Configuration ===" + echo "Main config exists: $(test -f _config.yml && echo 'YES' || echo 'NO')" + echo "Preview config exists: $(test -f _config_preview.yml && echo 'YES' || echo 'NO')" + # Remove CNAME file for previews to avoid routing conflicts rm -f CNAME - # Build Jekyll site - staging posts will be included as a collection - bundle exec jekyll build --config _config.yml,_config_preview.yml + # Build Jekyll site with maximum verbosity + echo "=== Running Jekyll Build ===" + bundle exec jekyll build --config _config.yml,_config_preview.yml --verbose --trace - # Verify build succeeded - if [ ! -d "_site" ] || [ -z "$(ls -A _site 2>/dev/null)" ]; then - echo "ERROR: Jekyll build failed or created empty _site directory" + # Check build results in detail + echo "=== Build Results ===" + if [ -d "_site" ]; then + echo "_site directory exists" + echo "Contents of _site/:" + find _site -type f -exec ls -la {} \; 2>/dev/null || echo "No files in _site" + echo "Total files: $(find _site -type f 2>/dev/null | wc -l)" + else + echo "ERROR: _site directory does not exist!" exit 1 fi - - echo "Build completed successfully" - echo "Files built: $(find _site -type f | wc -l)" env: JEKYLL_ENV: production From e6f8f5694a6ff6ac4858d95973892d4a918e2dfb Mon Sep 17 00:00:00 2001 From: Drew Kennedy Date: Tue, 10 Jun 2025 18:41:54 +1000 Subject: [PATCH 12/17] Test Jekyll build with main config first to isolate issue --- .github/workflows/preview.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 40aa7d9..e35397a 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -57,7 +57,19 @@ jobs: # Build Jekyll site with maximum verbosity echo "=== Running Jekyll Build ===" - bundle exec jekyll build --config _config.yml,_config_preview.yml --verbose --trace + echo "First, try building with main config only..." + bundle exec jekyll build --config _config.yml --verbose --trace + + echo "Main config build result:" + if [ -d "_site" ] && [ -n "$(ls -A _site 2>/dev/null)" ]; then + echo "✅ Main config build SUCCESS - _site has content" + echo "Now trying with preview config..." + rm -rf _site + bundle exec jekyll build --config _config.yml,_config_preview.yml --verbose --trace + else + echo "❌ Main config build FAILED or empty - stopping here" + exit 1 + fi # Check build results in detail echo "=== Build Results ===" From d3451fecf7695efade6be8c675803582aec08185 Mon Sep 17 00:00:00 2001 From: Drew Kennedy Date: Tue, 10 Jun 2025 18:43:59 +1000 Subject: [PATCH 13/17] Fix Liquid templating error: add null check for site.staging collection --- staging/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/staging/index.md b/staging/index.md index 21073ce..cc07e6f 100644 --- a/staging/index.md +++ b/staging/index.md @@ -16,8 +16,8 @@ This is where posts are staged for preview before going live. ## Staged Posts
- {% assign staging_posts = site.staging | sort: 'date' | reverse %} - {% if staging_posts.size > 0 %} + {% if site.staging and site.staging.size > 0 %} + {% assign staging_posts = site.staging | sort: 'date' | reverse %} {% for post in staging_posts %}
{{ post.title }} From e4a406a324e03f663a1713e0495a4b9b769594b3 Mon Sep 17 00:00:00 2001 From: Drew Kennedy Date: Tue, 10 Jun 2025 18:45:16 +1000 Subject: [PATCH 14/17] Add detailed build logging to capture Jekyll errors --- .github/workflows/preview.yml | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index e35397a..dd801a7 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -58,16 +58,36 @@ jobs: # Build Jekyll site with maximum verbosity echo "=== Running Jekyll Build ===" echo "First, try building with main config only..." - bundle exec jekyll build --config _config.yml --verbose --trace + + set -e # Exit on any error + + bundle exec jekyll build --config _config.yml --verbose 2>&1 | tee build-main.log echo "Main config build result:" if [ -d "_site" ] && [ -n "$(ls -A _site 2>/dev/null)" ]; then echo "✅ Main config build SUCCESS - _site has content" + echo "Files created: $(find _site -type f | wc -l)" + echo "Sample files:" + find _site -name "*.html" | head -5 + echo "Now trying with preview config..." rm -rf _site - bundle exec jekyll build --config _config.yml,_config_preview.yml --verbose --trace + bundle exec jekyll build --config _config.yml,_config_preview.yml --verbose 2>&1 | tee build-preview.log + + echo "Preview config build result:" + if [ -d "_site" ] && [ -n "$(ls -A _site 2>/dev/null)" ]; then + echo "✅ Preview config build SUCCESS" + echo "Files created: $(find _site -type f | wc -l)" + else + echo "❌ Preview config build FAILED or empty" + echo "Build log:" + cat build-preview.log + exit 1 + fi else - echo "❌ Main config build FAILED or empty - stopping here" + echo "❌ Main config build FAILED or empty" + echo "Build log:" + cat build-main.log exit 1 fi From 5b38b6b54039e5acc485ce75b7e1ad64ac756157 Mon Sep 17 00:00:00 2001 From: Drew Kennedy Date: Tue, 10 Jun 2025 18:51:53 +1000 Subject: [PATCH 15/17] Comment out staging config to test basic Jekyll build --- _config_preview.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/_config_preview.yml b/_config_preview.yml index 9103d2a..76f824e 100644 --- a/_config_preview.yml +++ b/_config_preview.yml @@ -1,20 +1,20 @@ # Preview-specific configuration # This extends the main _config.yml for preview builds -# Collections for staging posts -collections: - staging: - output: true - permalink: /:collection/:name/ +# Collections for staging posts - COMMENTED OUT FOR TESTING +# collections: +# staging: +# output: true +# permalink: /:collection/:name/ -# Make staging posts appear in site.posts -defaults: - - scope: - path: "staging" - type: "staging" - values: - layout: "post" +# Make staging posts appear in site.posts - COMMENTED OUT FOR TESTING +# defaults: +# - scope: +# path: "staging" +# type: "staging" +# values: +# layout: "post" -# Include staging directory in the build -include: - - staging +# Include staging directory in the build - COMMENTED OUT FOR TESTING +# include: +# - staging From 9bc6b9de58bac18335f96ace40f4abfc43be5444 Mon Sep 17 00:00:00 2001 From: Drew Kennedy Date: Tue, 10 Jun 2025 18:54:02 +1000 Subject: [PATCH 16/17] Simplify preview workflow to use same build logic as working pages.yml --- .github/workflows/preview.yml | 92 +++-------------------------------- 1 file changed, 8 insertions(+), 84 deletions(-) diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index dd801a7..c0ab124 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -32,100 +32,24 @@ jobs: echo "Published posts:" ls -1 _posts/*.md 2>/dev/null | head -5 || echo " (none)" - - name: Build Jekyll site with staging - run: | - echo "=== Building Jekyll site with staging ===" - - # Show what files are available to Jekyll - echo "=== Available content ===" - echo "Posts in _posts/:" - ls -la _posts/ 2>/dev/null || echo "No _posts directory" - - echo "Posts in staging/:" - ls -la staging/ 2>/dev/null || echo "No staging directory" - - echo "Index files:" - ls -la *.html *.md 2>/dev/null || echo "No index files" - - # Show Jekyll configs - echo "=== Jekyll Configuration ===" - echo "Main config exists: $(test -f _config.yml && echo 'YES' || echo 'NO')" - echo "Preview config exists: $(test -f _config_preview.yml && echo 'YES' || echo 'NO')" - - # Remove CNAME file for previews to avoid routing conflicts - rm -f CNAME - - # Build Jekyll site with maximum verbosity - echo "=== Running Jekyll Build ===" - echo "First, try building with main config only..." - - set -e # Exit on any error - - bundle exec jekyll build --config _config.yml --verbose 2>&1 | tee build-main.log - - echo "Main config build result:" - if [ -d "_site" ] && [ -n "$(ls -A _site 2>/dev/null)" ]; then - echo "✅ Main config build SUCCESS - _site has content" - echo "Files created: $(find _site -type f | wc -l)" - echo "Sample files:" - find _site -name "*.html" | head -5 - - echo "Now trying with preview config..." - rm -rf _site - bundle exec jekyll build --config _config.yml,_config_preview.yml --verbose 2>&1 | tee build-preview.log - - echo "Preview config build result:" - if [ -d "_site" ] && [ -n "$(ls -A _site 2>/dev/null)" ]; then - echo "✅ Preview config build SUCCESS" - echo "Files created: $(find _site -type f | wc -l)" - else - echo "❌ Preview config build FAILED or empty" - echo "Build log:" - cat build-preview.log - exit 1 - fi - else - echo "❌ Main config build FAILED or empty" - echo "Build log:" - cat build-main.log - exit 1 - fi - - # Check build results in detail - echo "=== Build Results ===" - if [ -d "_site" ]; then - echo "_site directory exists" - echo "Contents of _site/:" - find _site -type f -exec ls -la {} \; 2>/dev/null || echo "No files in _site" - echo "Total files: $(find _site -type f 2>/dev/null | wc -l)" - else - echo "ERROR: _site directory does not exist!" - exit 1 - fi + - name: Build with Jekyll + run: bundle exec jekyll build env: JEKYLL_ENV: production - - name: Deploy staging site + - name: Deploy to gh-pages run: | - echo "=== Deploying staging site ===" - - # Switch to gh-pages branch + # Switch to gh-pages branch git fetch origin gh-pages:gh-pages || git checkout --orphan gh-pages git checkout gh-pages - # Clear all content and deploy full site to root + # Clear and copy site rm -rf * 2>/dev/null || true - rm -rf .*/ 2>/dev/null || true - - # Copy built site to root of gh-pages - cp -r _site/* ./ + cp -r _site/* ./ 2>/dev/null || true - # Commit and push the staging site + # Commit and push git add -A git config user.name "GitHub Actions" git config user.email "actions@github.com" - git commit -m "Deploy staging preview from PR #${{ github.event.number }}" || exit 0 + git commit -m "Deploy preview from PR #${{ github.event.number }}" || exit 0 git push origin gh-pages - - echo "=== Staging deployment complete ===" - echo "Preview URL: https://devnomadic.github.io/" From af26fc58531a79bad50b0506d7b64457547f2f89 Mon Sep 17 00:00:00 2001 From: Drew Kennedy Date: Tue, 10 Jun 2025 18:56:25 +1000 Subject: [PATCH 17/17] Re-enable staging configuration with working build foundation --- .github/workflows/preview.yml | 6 +++++- _config_preview.yml | 30 +++++++++++++++--------------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index c0ab124..0bf767b 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -33,7 +33,11 @@ jobs: ls -1 _posts/*.md 2>/dev/null | head -5 || echo " (none)" - name: Build with Jekyll - run: bundle exec jekyll build + run: | + # Remove CNAME to avoid conflicts with preview + rm -f CNAME + # Build with preview config that includes staging + bundle exec jekyll build --config _config.yml,_config_preview.yml env: JEKYLL_ENV: production diff --git a/_config_preview.yml b/_config_preview.yml index 76f824e..9103d2a 100644 --- a/_config_preview.yml +++ b/_config_preview.yml @@ -1,20 +1,20 @@ # Preview-specific configuration # This extends the main _config.yml for preview builds -# Collections for staging posts - COMMENTED OUT FOR TESTING -# collections: -# staging: -# output: true -# permalink: /:collection/:name/ +# Collections for staging posts +collections: + staging: + output: true + permalink: /:collection/:name/ -# Make staging posts appear in site.posts - COMMENTED OUT FOR TESTING -# defaults: -# - scope: -# path: "staging" -# type: "staging" -# values: -# layout: "post" +# Make staging posts appear in site.posts +defaults: + - scope: + path: "staging" + type: "staging" + values: + layout: "post" -# Include staging directory in the build - COMMENTED OUT FOR TESTING -# include: -# - staging +# Include staging directory in the build +include: + - staging