Skip to content

Commit

Permalink
Support full CI/CD (#156)
Browse files Browse the repository at this point in the history
* Create CD github action

* Upgrade deploy command

* Refactor linting into linting action
  • Loading branch information
Nolski authored Feb 17, 2025
1 parent 1a35f55 commit 1414f46
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 14 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/deploy-book.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: deploy-book

# Runs on main branch changes or manual dispatch
on:
workflow_dispatch:
push:
branches:
- main

# This job installs dependencies, builds the book, and pushes it to `gh-pages`
jobs:
build:
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
steps:
- uses: actions/checkout@v3

# Install dependencies
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install dependencies
run: |
pip install -r requirements.txt
# Build the book
- name: Build the book
run: |
jupyter-book build --all .
# Upload the book's HTML as an artifact
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "_build/html"

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
needs: build
steps:

# Deploy the book's HTML to GitHub Pages
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
17 changes: 10 additions & 7 deletions .github/workflows/link-check.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Check Links
name: Lint Markdown and check links
on:
push:
pull_request:
branches:
- main

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

- name: Install Dependencies
run: npm install -g markdown-link-check

- name: Check Links
run: markdown-link-check -q ./*.md -c mdlinkcheckconfig.json && markdown-link-check ./**/*.md -q -c mdlinkcheckconfig.json
run: |
npm install
npm install -g markdownlint-cli
npm install -g markdown-link-check
- name: Lint markdown
run: npm run lint
- name: Link check
run: npm run links-ci
9 changes: 8 additions & 1 deletion mdlinkcheckconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
{
"pattern": "https://doi.org/10.7910/DVN/TJCLKP"
},
{
"pattern": "https://ospoplusplus.com"
},
{
"pattern": "https://www.turing.ac.uk",
"reason": "403"
Expand All @@ -36,9 +39,13 @@
"pattern": "https://www.aps.org/",
"reason": "403"
},
{
"pattern": "https://www.aaas.org/",
"reason": "403"
},
{
"pattern": "https://openai.com/",
"reason": "403"
}
]
}
}
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@
"description": "An ecosystem map for academic OSS",
"scripts": {
"build": "jupyter-book build --all .",

"publish": "./build.sh",

"lint": "markdownlint . -i _build/ -i node_modules",
"lint-fix": "markdownlint --fix . -i _build/ -i node_modules",
"links": "markdown-link-check ./*.md -c mdlinkcheckconfig.json && markdown-link-check ./**/*.md -c mdlinkcheckconfig.json",
"links-ci": "markdown-link-check -q ./*.md -c mdlinkcheckconfig.json && markdown-link-check ./**/*.md -q -c mdlinkcheckconfig.json",

"run-all": "npm run lint && npm run links-ci",
"pretest": "npm run lint-fix"
},
Expand Down

0 comments on commit 1414f46

Please sign in to comment.