From 1414f46dbc23c10c346fb0356e0e5342dc84ee49 Mon Sep 17 00:00:00 2001 From: Mike Nolan Date: Mon, 17 Feb 2025 18:51:56 +0000 Subject: [PATCH] Support full CI/CD (#156) * Create CD github action * Upgrade deploy command * Refactor linting into linting action --- .github/workflows/deploy-book.yml | 55 +++++++++++++++++++++++++++++++ .github/workflows/link-check.yml | 17 ++++++---- mdlinkcheckconfig.json | 9 ++++- package-lock.json | 6 ++-- package.json | 3 -- 5 files changed, 76 insertions(+), 14 deletions(-) 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..594186a --- /dev/null +++ b/.github/workflows/deploy-book.yml @@ -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 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 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" },