Skip to content
Merged
Show file tree
Hide file tree
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
38 changes: 38 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Deploy production site

on:
push:
branches: [ main ]

permissions:
contents: write

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

# If you use Jekyll via Bundler; adjust if you use something else (Hugo, etc.)
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true

- name: Build site
run: |
bundle exec jekyll build -d _site

- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_site
publish_branch: gh-pages
# This is the production site, so deploy to root
destination_dir: .
keep_files: false
commit_message: "Deploy production site from main"
49 changes: 49 additions & 0 deletions .github/workflows/pr-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: PR preview

on:
pull_request:
types: [opened, synchronize, reopened]

permissions:
contents: write
pull-requests: write

jobs:
build-and-preview:
runs-on: ubuntu-latest

steps:
- name: Checkout PR branch
uses: actions/checkout@v4

# Same build setup as production – keep these in sync
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true

- name: Build preview site
run: |
bundle exec jekyll build --config _config.yml --destination _site_preview

- name: Deploy preview to gh-pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_site_preview
publish_branch: gh-pages
# Put previews under /previews/pr-<number>/
destination_dir: previews/pr-${{ github.event.pull_request.number }}
keep_files: true
commit_message: "Deploy preview for PR #${{ github.event.pull_request.number }}"

- name: Comment preview URL on PR
uses: marocchino/sticky-pull-request-comment@v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
header: preview-url
message: |
✅ Preview deployed for this PR.

URL: [blog.matthewpersico.com](https://blog.matthewpersico.com/previews/pr-${{ github.event.pull_request.number }}/)
File renamed without changes.
1 change: 1 addition & 0 deletions assets/deploy-trigger
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Change this file to force a PR change and a deployment if no other files change.
Loading