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
15 changes: 13 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
branches:
- main

concurrency:
group: gh-pages
cancel-in-progress: false

permissions:
contents: write

Expand All @@ -17,12 +21,19 @@ jobs:
- uses: actions/setup-python@v6
with:
python-version: '3.10'
- uses: abatilo/actions-poetry@v4
- uses: abatilo/actions-poetry@0dd19c9498c3dc8728967849d0d2eae428a8a3d8 # v4
with:
poetry-version: 2.1.4

- name: Install dependencies
run: |
poetry install --without dev
- name: Build
run: poetry run make html
- name: Deploy
run: poetry run make deploy
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4
with:
folder: build/html
branch: gh-pages
force: false
clean-exclude: pr-preview/
64 changes: 64 additions & 0 deletions .github/workflows/preview-fork.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Deploy Fork PR Preview

# Org admins can manually deploy/remove a preview for a PR from a fork.
# rossjrw/pr-preview-action@v1 does not support forks automatically,
# so this workflow is the workaround until v2 is released.
#
# ⚠️ Only trigger this after reviewing the fork's code, since it checks
# out and runs code from the PR branch.

on:
workflow_dispatch:
inputs:
pr_number:
description: 'PR number (from a fork)'
required: true
type: number
action:
description: 'Action to perform'
type: choice
options:
- deploy
- remove
default: deploy

concurrency:
group: gh-pages
cancel-in-progress: false

permissions:
contents: write
pull-requests: write

jobs:
deploy-fork-preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: refs/pull/${{ inputs.pr_number }}/head

- uses: actions/setup-python@v6
if: inputs.action == 'deploy'
with:
python-version: '3.10'

- uses: abatilo/actions-poetry@0dd19c9498c3dc8728967849d0d2eae428a8a3d8 # v4
if: inputs.action == 'deploy'
with:
poetry-version: 2.1.4

- name: Install dependencies
if: inputs.action == 'deploy'
run: poetry install --without dev

- name: Build
if: inputs.action == 'deploy'
run: poetry run make html

- name: Deploy preview
uses: rossjrw/pr-preview-action@ffa7509e91a3ec8dfc2e5536c4d5c1acdf7a6de9 # v1
with:
source-dir: ./build/html/
pr-number: ${{ inputs.pr_number }}
action: ${{ inputs.action }}
13 changes: 8 additions & 5 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ on:
- synchronize
- closed

concurrency:
group: preview-${{ github.ref }}
cancel-in-progress: true
concurrency:
group: gh-pages
cancel-in-progress: false

permissions:
contents: write
Expand All @@ -24,15 +24,18 @@ jobs:
- uses: actions/setup-python@v6
with:
python-version: '3.10'
- uses: abatilo/actions-poetry@v4
- uses: abatilo/actions-poetry@0dd19c9498c3dc8728967849d0d2eae428a8a3d8 # v4
with:
poetry-version: 2.1.4

- name: Install dependencies
if: github.event.action != 'closed'
run: poetry install --without dev
- name: Build
if: github.event.action != 'closed'
run: poetry run make html
- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
uses: rossjrw/pr-preview-action@ffa7509e91a3ec8dfc2e5536c4d5c1acdf7a6de9 # v1
if: github.event.pull_request.head.repo.full_name == github.repository
with:
source-dir: ./build/html/
Loading