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 +--- + + + +
Page not found :(
+The requested page could not be found.
+ + +No posts currently staged for preview.
+ {% endif %} +