Skip to content

Commit a498e89

Browse files
update github actions
1 parent 19587f2 commit a498e89

File tree

1 file changed

+38
-23
lines changed

1 file changed

+38
-23
lines changed

.github/workflows/main.yml

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,61 @@
1-
name: DataJoint Book GitHub Pages Deploy
1+
name: Build and Deploy DataJoint Book
2+
3+
# Run on pushes to the main branch and on pull requests
24
on:
35
push:
46
# Runs on pushes targeting the default branch
57
branches: [main]
6-
env:
7-
# `BASE_URL` determines the website is served from, including CSS & JS assets
8-
# You may need to change this to `BASE_URL: ''`
9-
BASE_URL: /${{ github.event.repository.name }}
8+
pull_request:
9+
branches: [main]
1010

1111
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
1212
permissions:
1313
contents: read
1414
pages: write
1515
id-token: write
16+
1617
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
17-
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
1818
concurrency:
19-
group: 'pages'
19+
group: ${{ github.workflow }}-${{ github.ref }}
2020
cancel-in-progress: false
21+
2122
jobs:
22-
deploy:
23-
environment:
24-
name: github-pages
25-
url: ${{ steps.deployment.outputs.page_url }}
23+
build:
2624
runs-on: ubuntu-latest
2725
steps:
28-
- uses: actions/checkout@v4
29-
- name: Setup Pages
30-
uses: actions/configure-pages@v3
31-
- uses: actions/setup-node@v4
26+
- name: Checkout your repository
27+
uses: actions/checkout@v4
28+
29+
- name: Setup Node.js and cache dependencies
30+
uses: actions/setup-node@v4
3231
with:
33-
node-version: 18.x
32+
node-version: '20' # Using a more current LTS version
33+
cache: 'npm' # ⚡️ Cache npm packages for faster subsequent runs
34+
3435
- name: Install MyST Markdown
3536
run: npm install -g mystmd
36-
- name: Build HTML Assets
37-
run: |
38-
cd book
39-
myst build --html
40-
- name: Upload artifact
41-
uses: actions/upload-pages-artifact@v4
37+
38+
- name: Build HTML assets
39+
run: myst build book/myst.yml --html # It's good practice to specify the config file
40+
41+
- name: Upload artifact for deployment
42+
uses: actions/upload-pages-artifact@v3
4243
with:
4344
path: './book/_build/html'
45+
46+
deploy:
47+
# Requires the build job to succeed
48+
needs: build
49+
50+
# Deploy only when pushing to the main branch, not on pull requests
51+
if: github.ref == 'refs/heads/main'
52+
53+
environment:
54+
name: github-pages
55+
url: ${{ steps.deployment.outputs.page_url }}
56+
57+
runs-on: ubuntu-latest
58+
steps:
4459
- name: Deploy to GitHub Pages
4560
id: deployment
46-
uses: actions/deploy-pages@v2
61+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)