Skip to content

Commit 0fc135c

Browse files
committed
Adding some features to the build
1 parent ce56804 commit 0fc135c

1 file changed

Lines changed: 36 additions & 15 deletions

File tree

.github/workflows/deploy-jb.yml

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@ on:
66
push:
77
# Runs on pushes targeting the default branch
88
branches: [main]
9+
pull_request:
10+
branches: [main]
11+
workflow_dispatch:
12+
inputs:
13+
deploy:
14+
description: 'Deploy to GitHub Pages'
15+
required: false
16+
default: 'false'
17+
type: choice
18+
options:
19+
- 'true'
20+
- 'false'
21+
922
env:
1023
# `BASE_URL` determines, relative to the root of the domain, the URL that your site is served from.
1124
# E.g., if your site lives at `https://mydomain.org/myproject`, set `BASE_URL=/myproject`.
@@ -22,42 +35,50 @@ permissions:
2235
concurrency:
2336
group: 'pages'
2437
cancel-in-progress: false
25-
38+
2639
jobs:
27-
deploy:
28-
environment:
29-
name: github-pages
30-
# url: ${{ steps.deployment.outputs.page_url }}
40+
build:
3141
runs-on: ubuntu-latest
32-
42+
3343
steps:
34-
- name: Checkout repo
44+
- name: Checkout repo
3545
uses: actions/checkout@v4
36-
46+
3747
- name: Set up Python
3848
uses: actions/setup-python@v5
3949
with:
4050
python-version: "3.11"
4151
cache: 'pip' # caching pip dependencies
42-
52+
4353
- name: Install dependencies
4454
run: |
4555
pip install -r requirements.txt
46-
56+
4757
- name: Install Jupyter Book (via myst)
48-
run: pip install jupyter-book
49-
58+
run: pip install jupyter-book
59+
5060
- name: Build HTML Assets
5161
run: |
5262
cd website
5363
jupyter-book build --html
54-
64+
5565
- name: Upload artifact
5666
uses: actions/upload-pages-artifact@v3
5767
with:
5868
path: './website/_build/site'
59-
69+
70+
deploy:
71+
needs: build
72+
# Deploy on push to main, or on manual trigger when deploy=true
73+
if: |
74+
github.event_name == 'push' ||
75+
(github.event_name == 'workflow_dispatch' && inputs.deploy == 'true')
76+
environment:
77+
name: github-pages
78+
# url: ${{ steps.deployment.outputs.page_url }}
79+
runs-on: ubuntu-latest
80+
81+
steps:
6082
- name: Deploy to GitHub Pages
6183
id: deployment
6284
uses: actions/deploy-pages@v4
63-

0 commit comments

Comments
 (0)