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
58 changes: 49 additions & 9 deletions .github/workflows/blog-framework.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@ on:
- 'posts*.json'
- '.github/workflows/blog-framework.yml'
push:
# Any push to main redeploys the whole site (Astro build of dist/),
# so root chrome like index*.html / sitemap.xml / CNAME is picked up too.
branches:
- main
paths:
- 'astro.config.mjs'
- 'package.json'
- 'package-lock.json'
- 'scripts/**'
- 'src/**'
- 'blog/**'
- 'posts*.json'
- '.github/workflows/blog-framework.yml'

# GITHUB_TOKEN defaults; the deploy job widens its own permissions below.
permissions:
contents: read

# Never run two Pages deployments at once; let an in-flight one finish.
concurrency:
group: pages
cancel-in-progress: false

jobs:
build-and-check:
Expand Down Expand Up @@ -84,3 +86,41 @@ jobs:
if [ -f /tmp/bytefuture-preview.pid ]; then
kill "$(cat /tmp/bytefuture-preview.pid)" || true
fi

# Publish the Astro build (dist/) to GitHub Pages on every push to main.
# Requires the repo's Pages source to be set to "GitHub Actions".
deploy:
needs: build-and-check
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build Astro static site
run: npm run build

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: dist

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
Loading