From 4168022197a919f100d2272bf6601a581ae096aa Mon Sep 17 00:00:00 2001 From: Mike Nolan Date: Fri, 14 Feb 2025 16:29:42 +0000 Subject: [PATCH 1/3] Create CD github action --- .github/workflows/deploy-book.yml | 65 +++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/deploy-book.yml diff --git a/.github/workflows/deploy-book.yml b/.github/workflows/deploy-book.yml new file mode 100644 index 0000000..837eecd --- /dev/null +++ b/.github/workflows/deploy-book.yml @@ -0,0 +1,65 @@ +name: deploy-book + +# Run this when the master or main branch changes +on: + workflow_dispatch: + push: + branches: + - main + # If your git repository has the Jupyter Book within some-subfolder next to + # unrelated files, you can make this run only if a file within that specific + # folder has been modified. + # + # paths: + # - some-subfolder/** + +# This job installs dependencies, builds the book, and pushes it to `gh-pages` +jobs: + deploy-book: + 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: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' + + - name: Install dependencies + run: | + pip install -r requirements.txt + + # (optional) Cache your executed notebooks between runs + # if you have config: + # execute: + # execute_notebooks: cache + - name: cache executed notebooks + uses: actions/cache@v3 + with: + path: _build/.jupyter_cache + key: jupyter-book-cache-${{ hashFiles('requirements.txt') }} + + # Build the book + - name: Build the book + run: | + sh ./build.sh + + # Upload the book's HTML as an artifact + - name: Upload artifact + uses: actions/upload-pages-artifact@v4 + with: + path: "_build/html" + + # Deploy the book's HTML to GitHub Pages + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 From 0019a4fbaa803cf407c4f7208e96e1778a2cebf0 Mon Sep 17 00:00:00 2001 From: Mike Nolan Date: Fri, 14 Feb 2025 17:00:41 +0000 Subject: [PATCH 2/3] Upgrade deploy command --- .github/workflows/deploy-book.yml | 31 ++++++++++++++++++++++++++----- mdlinkcheckconfig.json | 9 ++++++++- package-lock.json | 6 +++--- package.json | 3 --- 4 files changed, 37 insertions(+), 12 deletions(-) diff --git a/.github/workflows/deploy-book.yml b/.github/workflows/deploy-book.yml index 837eecd..136b7a9 100644 --- a/.github/workflows/deploy-book.yml +++ b/.github/workflows/deploy-book.yml @@ -15,7 +15,7 @@ on: # This job installs dependencies, builds the book, and pushes it to `gh-pages` jobs: - deploy-book: + build: runs-on: ubuntu-latest permissions: pages: write @@ -30,10 +30,16 @@ jobs: python-version: 3.11 - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: '18' + - name: Node install + run: | + npm install + npm install -g markdownlint-cli + markdownlint --help + - name: Install dependencies run: | pip install -r requirements.txt @@ -48,18 +54,33 @@ jobs: path: _build/.jupyter_cache key: jupyter-book-cache-${{ hashFiles('requirements.txt') }} + - name: Lint + run: | + npm run run-all + # Build the book - name: Build the book run: | - sh ./build.sh + jupyter-book build --all . # Upload the book's HTML as an artifact - name: Upload artifact - uses: actions/upload-pages-artifact@v4 + 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@v2 + uses: actions/deploy-pages@v4 diff --git a/mdlinkcheckconfig.json b/mdlinkcheckconfig.json index 5dc2a50..4c607d2 100644 --- a/mdlinkcheckconfig.json +++ b/mdlinkcheckconfig.json @@ -24,6 +24,9 @@ { "pattern": "https://doi.org/10.7910/DVN/TJCLKP" }, + { + "pattern": "https://ospoplusplus.com" + }, { "pattern": "https://www.turing.ac.uk", "reason": "403" @@ -36,9 +39,13 @@ "pattern": "https://www.aps.org/", "reason": "403" }, + { + "pattern": "https://www.aaas.org/", + "reason": "403" + }, { "pattern": "https://openai.com/", "reason": "403" } ] -} \ No newline at end of file +} diff --git a/package-lock.json b/package-lock.json index d1f9568..53bfcbe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -950,9 +950,9 @@ "license": "MIT" }, "node_modules/undici": { - "version": "6.20.1", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.20.1.tgz", - "integrity": "sha512-AjQF1QsmqfJys+LXfGTNum+qw4S88CojRInG/6t31W/1fk6G59s92bnAvGz5Cmur+kQv2SURXEvvudLmbrE8QA==", + "version": "6.21.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.21.1.tgz", + "integrity": "sha512-q/1rj5D0/zayJB2FraXdaWxbhWiNKDvu8naDT2dl1yTlvJp4BLtOcp2a5BvgGNQpYYJzau7tf1WgKv3b+7mqpQ==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index 1572b70..4ced300 100644 --- a/package.json +++ b/package.json @@ -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" }, From ba402f67d3fc8c1baf4840a608e968fd48f5a246 Mon Sep 17 00:00:00 2001 From: Mike Nolan Date: Mon, 17 Feb 2025 15:24:30 +0000 Subject: [PATCH 3/3] Refactor linting into linting action --- .github/workflows/deploy-book.yml | 33 +------------------------------ .github/workflows/link-check.yml | 17 +++++++++------- 2 files changed, 11 insertions(+), 39 deletions(-) diff --git a/.github/workflows/deploy-book.yml b/.github/workflows/deploy-book.yml index 136b7a9..594186a 100644 --- a/.github/workflows/deploy-book.yml +++ b/.github/workflows/deploy-book.yml @@ -1,17 +1,11 @@ name: deploy-book -# Run this when the master or main branch changes +# Runs on main branch changes or manual dispatch on: workflow_dispatch: push: branches: - main - # If your git repository has the Jupyter Book within some-subfolder next to - # unrelated files, you can make this run only if a file within that specific - # folder has been modified. - # - # paths: - # - some-subfolder/** # This job installs dependencies, builds the book, and pushes it to `gh-pages` jobs: @@ -29,35 +23,10 @@ jobs: with: python-version: 3.11 - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: '18' - - - name: Node install - run: | - npm install - npm install -g markdownlint-cli - markdownlint --help - - name: Install dependencies run: | pip install -r requirements.txt - # (optional) Cache your executed notebooks between runs - # if you have config: - # execute: - # execute_notebooks: cache - - name: cache executed notebooks - uses: actions/cache@v3 - with: - path: _build/.jupyter_cache - key: jupyter-book-cache-${{ hashFiles('requirements.txt') }} - - - name: Lint - run: | - npm run run-all - # Build the book - name: Build the book run: | diff --git a/.github/workflows/link-check.yml b/.github/workflows/link-check.yml index 16f7bf4..6d045f5 100644 --- a/.github/workflows/link-check.yml +++ b/.github/workflows/link-check.yml @@ -1,6 +1,6 @@ -name: Check Links +name: Lint Markdown and check links on: - push: + pull_request: branches: - main @@ -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 \ No newline at end of file + 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