Skip to content
Open
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: 58 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Deploy to GitHub Pages

on:
push:
branches: [main]
workflow_dispatch:
Comment thread
mmcky marked this conversation as resolved.

# Minimal top-level permissions: build job only needs to read the repo.
# Deployment credentials (pages: write, id-token: write) are scoped to
# the deploy job only, so a compromised build step cannot use them.
permissions:
contents: read

# Only one deployment at a time; don't cancel in-flight deploys.
concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true

- name: Setup Pages
id: pages
uses: actions/configure-pages@v5

- name: Build Jekyll site
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
env:
JEKYLL_ENV: production

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

deploy:
# Guard: only deploy from main, even when triggered via workflow_dispatch
# on a different branch.
if: github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
permissions:
pages: write
id-token: write
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4