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
29 changes: 18 additions & 11 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,36 @@
name: Build and Deploy Site

on:
push:
branches: [master]
workflow_dispatch:
workflow_call:


permissions:
contents: write

concurrency:
group: "pages-deployment"
cancel-in-progress: true

jobs:
build-and-deploy:
permissions:
contents: write
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Checkout 🛎️
uses: actions/checkout@master
uses: actions/checkout@v6
with:
fetch-depth: 1
fetch-depth: 0

- name: Install and Build 🔧
run: |
make setup
make build

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.7.3
- name: Deploy to GitHub Pages 🚀
uses: peaceiris/actions-gh-pages@v4
with:
branch: site # The branch the action should deploy to.
folder: site/public # The folder the action should deploy.
clean: true
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site/public
publish_branch: gh-pages
keep_files: true
80 changes: 63 additions & 17 deletions .github/workflows/build-and-preview-site.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,78 @@
name: Build and Preview Site

on:
pull_request:
pull_request_target:
branches: [master]
types: [opened, synchronize, reopened]
types: [opened, synchronize, reopened, closed]

permissions:
contents: write
pull-requests: write

concurrency:
group: "preview-${{ github.event.pull_request.number || github.run_id }}"
cancel-in-progress: true

jobs:
site-preview:
runs-on: ubuntu-latest
build-and-deploy-preview:
runs-on: ubuntu-24.04
steps:
- name: Checkout 🛎️
uses: actions/checkout@master
- name: Checkout PR
if: github.event.action != 'closed'
uses: actions/checkout@v6
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
fetch-depth: 1
fetch-depth: 0

- name: Install and Build 🔧
- name: Checkout for cleanup
if: github.event.action == 'closed'
uses: actions/checkout@v6
with:
ref: gh-pages
fetch-depth: 0

- name: Install and Build
if: github.event.action != 'closed'
run: |
make setup
make build

- name: Zip Site
run: bash ./script.sh
- name: Add robots.txt for previews
if: github.event.action != 'closed'
run: |
cat > site/public/robots.txt <<'EOF'
User-agent: *
Disallow: /
EOF

- name: Deploy PR preview
if: github.event.action != 'closed'
uses: rossjrw/pr-preview-action@v1.6.3
with:
source-dir: ./site/public
preview-branch: gh-pages
umbrella-dir: pr-preview
action: auto
comment: false

- name: Comment PR with Preview URL
if: github.event.action != 'closed'
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-preview
message: |
🚀 **Preview deployment for PR #${{ github.event.pull_request.number }}**

🌐 **Preview URL**: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr-preview/pr-${{ github.event.pull_request.number }}/

_This preview is updated automatically when commits are pushed to this PR._

- name: Upload files
uses: actions/upload-artifact@v4
- name: Cleanup PR preview on close
if: github.event.action == 'closed'
uses: rossjrw/pr-preview-action@v1.6.3
with:
name: public-dir
path: public-dir.zip
retention-days: 1
- name: Trigger Inner workflow
run: echo "triggering inner workflow"
preview-branch: gh-pages
umbrella-dir: pr-preview
action: remove
52 changes: 0 additions & 52 deletions .github/workflows/preview-site.yml

This file was deleted.

Loading