diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 810520f..0bf767b 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -1,21 +1,17 @@ -name: Deploy PR Preview +name: Deploy Staging Preview on: pull_request: - types: - - opened - - reopened - - synchronize - - closed + types: [opened, synchronize, reopened] + 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,18 +23,37 @@ jobs: ruby-version: '3.1' bundler-cache: true - - name: Build Jekyll site - if: github.event.action != 'closed' + - name: Show staging content run: | - # Remove CNAME file for previews to avoid routing conflicts + echo "=== Staging content ===" + echo "Staging posts:" + 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 with Jekyll + run: | + # Remove CNAME to avoid conflicts with preview rm -f CNAME - bundle exec jekyll build + # Build with preview config that includes staging + bundle exec jekyll build --config _config.yml,_config_preview.yml 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 gh-pages + run: | + # Switch to gh-pages branch + git fetch origin gh-pages:gh-pages || git checkout --orphan gh-pages + git checkout gh-pages + + # Clear and copy site + rm -rf * 2>/dev/null || true + cp -r _site/* ./ 2>/dev/null || true + + # Commit and push + git add -A + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + git commit -m "Deploy preview from PR #${{ github.event.number }}" || exit 0 + git push origin gh-pages 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 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/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 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! diff --git a/staging/README.md b/staging/README.md new file mode 100644 index 0000000..fe9af28 --- /dev/null +++ b/staging/README.md @@ -0,0 +1,18 @@ +# 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/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 diff --git a/staging/index.md b/staging/index.md new file mode 100644 index 0000000..cc07e6f --- /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 + +
+ {% if site.staging and site.staging.size > 0 %} + {% assign staging_posts = site.staging | sort: 'date' | reverse %} + {% 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/) + + 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