-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Enable PR previews * Don't worry about baseurl for now * Use a different sed separator
- Loading branch information
Showing
2 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: deploy-book-preview | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
- closed | ||
|
||
concurrency: preview-${{ github.ref }} | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
concurrency: pages-main | ||
|
||
steps: | ||
- name: Checkout book | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Python 3.12 | ||
if: github.event.action != 'closed' | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
|
||
- name: Install dependencies | ||
if: github.event.action != 'closed' | ||
run: | | ||
pip install -r requirements.txt | ||
- name: Get GitHub Pages URL | ||
id: pages | ||
if: github.event.action != 'closed' | ||
uses: actions/configure-pages@v4 | ||
|
||
- name: Replace base URL | ||
if: github.event.action != 'closed' | ||
run: | | ||
sed -i 's~baseurl: ""~baseurl: "${{ steps.pages.outputs.base_url }}/preview/pr-${{ github.event.number }}"~g' _config.yml | ||
- name: Build book | ||
if: github.event.action != 'closed' | ||
run: | | ||
jupyter-book build . | ||
- name: Disable Jekyll to serve static HTML | ||
run: | | ||
touch _build/html/.nojekyll | ||
- name: Commit preview to Pages branch | ||
uses: rossjrw/pr-preview-action@v1.4.7 | ||
with: | ||
source-dir: "_build/html" | ||
umbrella-dir: preview |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters