Skip to content

Commit 1414f46

Browse files
authored
Support full CI/CD (#156)
* Create CD github action * Upgrade deploy command * Refactor linting into linting action
1 parent 1a35f55 commit 1414f46

File tree

5 files changed

+76
-14
lines changed

5 files changed

+76
-14
lines changed

.github/workflows/deploy-book.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: deploy-book
2+
3+
# Runs on main branch changes or manual dispatch
4+
on:
5+
workflow_dispatch:
6+
push:
7+
branches:
8+
- main
9+
10+
# This job installs dependencies, builds the book, and pushes it to `gh-pages`
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
pages: write
16+
id-token: write
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
# Install dependencies
21+
- name: Set up Python 3.11
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: 3.11
25+
26+
- name: Install dependencies
27+
run: |
28+
pip install -r requirements.txt
29+
30+
# Build the book
31+
- name: Build the book
32+
run: |
33+
jupyter-book build --all .
34+
35+
# Upload the book's HTML as an artifact
36+
- name: Upload artifact
37+
uses: actions/upload-pages-artifact@v3
38+
with:
39+
path: "_build/html"
40+
41+
deploy:
42+
environment:
43+
name: github-pages
44+
url: ${{ steps.deployment.outputs.page_url }}
45+
runs-on: ubuntu-latest
46+
permissions:
47+
pages: write
48+
id-token: write
49+
needs: build
50+
steps:
51+
52+
# Deploy the book's HTML to GitHub Pages
53+
- name: Deploy to GitHub Pages
54+
id: deployment
55+
uses: actions/deploy-pages@v4

.github/workflows/link-check.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
name: Check Links
1+
name: Lint Markdown and check links
22
on:
3-
push:
3+
pull_request:
44
branches:
55
- main
66

@@ -15,11 +15,14 @@ jobs:
1515
- name: Set up Node.js
1616
uses: actions/setup-node@v3
1717
with:
18-
# I had an issue here where the node-version needed to be above '14'
1918
node-version: '18'
2019

2120
- name: Install Dependencies
22-
run: npm install -g markdown-link-check
23-
24-
- name: Check Links
25-
run: markdown-link-check -q ./*.md -c mdlinkcheckconfig.json && markdown-link-check ./**/*.md -q -c mdlinkcheckconfig.json
21+
run: |
22+
npm install
23+
npm install -g markdownlint-cli
24+
npm install -g markdown-link-check
25+
- name: Lint markdown
26+
run: npm run lint
27+
- name: Link check
28+
run: npm run links-ci

mdlinkcheckconfig.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
{
2525
"pattern": "https://doi.org/10.7910/DVN/TJCLKP"
2626
},
27+
{
28+
"pattern": "https://ospoplusplus.com"
29+
},
2730
{
2831
"pattern": "https://www.turing.ac.uk",
2932
"reason": "403"
@@ -36,9 +39,13 @@
3639
"pattern": "https://www.aps.org/",
3740
"reason": "403"
3841
},
42+
{
43+
"pattern": "https://www.aaas.org/",
44+
"reason": "403"
45+
},
3946
{
4047
"pattern": "https://openai.com/",
4148
"reason": "403"
4249
}
4350
]
44-
}
51+
}

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@
55
"description": "An ecosystem map for academic OSS",
66
"scripts": {
77
"build": "jupyter-book build --all .",
8-
98
"publish": "./build.sh",
10-
119
"lint": "markdownlint . -i _build/ -i node_modules",
1210
"lint-fix": "markdownlint --fix . -i _build/ -i node_modules",
1311
"links": "markdown-link-check ./*.md -c mdlinkcheckconfig.json && markdown-link-check ./**/*.md -c mdlinkcheckconfig.json",
1412
"links-ci": "markdown-link-check -q ./*.md -c mdlinkcheckconfig.json && markdown-link-check ./**/*.md -q -c mdlinkcheckconfig.json",
15-
1613
"run-all": "npm run lint && npm run links-ci",
1714
"pretest": "npm run lint-fix"
1815
},

0 commit comments

Comments
 (0)