Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ on:
paths:
- "docs/**"
- ".github/workflows/pages.yml"
pull_request:
branches: [main]
paths:
- "docs/**"
- ".github/workflows/pages.yml"

permissions:
contents: read
Expand All @@ -19,13 +24,34 @@ concurrency:
jobs:
build:
runs-on: ubuntu-latest
outputs:
pages_configured: ${{ steps.pages_site.outputs.configured }}
steps:
- uses: actions/checkout@v6

- name: Detect Pages site
id: pages_site
env:
GH_TOKEN: ${{ github.token }}
run: |
if [ "${{ github.event_name }}" != "push" ]; then
echo "configured=false" >> "$GITHUB_OUTPUT"
exit 0
fi

if curl -fsSL \
-H "Authorization: Bearer ${GH_TOKEN}" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${GITHUB_REPOSITORY}/pages" >/dev/null; then
echo "configured=true" >> "$GITHUB_OUTPUT"
else
echo "configured=false" >> "$GITHUB_OUTPUT"
echo "::notice::GitHub Pages is not configured for this repository; skipping artifact upload and deploy."
fi

- name: Setup Pages
if: github.event_name == 'push' && steps.pages_site.outputs.configured == 'true'
uses: actions/configure-pages@v6
with:
enablement: true

- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
Expand All @@ -34,9 +60,11 @@ jobs:
destination: ./_site

- name: Upload artifact
if: github.event_name == 'push' && steps.pages_site.outputs.configured == 'true'
uses: actions/upload-pages-artifact@v4

deploy:
if: github.event_name == 'push' && needs.build.outputs.pages_configured == 'true'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
Expand Down
Loading