From 1d9b220f49034b4b45dd93022141b53c1b186293 Mon Sep 17 00:00:00 2001 From: Casey Link Date: Mon, 27 May 2024 15:31:03 +0200 Subject: [PATCH] ci: update build workflow --- .github/workflows/gh-pages.yml | 30 +++++++++---- bb.edn | 8 ++-- package.json | 81 +++++++++++++++++----------------- 3 files changed, 65 insertions(+), 54 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index a4c5d6a..bfa6d59 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -6,8 +6,10 @@ on: - main jobs: publish: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 + - name: Cache Maven packages uses: actions/cache@v4 with: @@ -18,7 +20,10 @@ jobs: key: ${{ runner.os }}-m2-${{ hashFiles('**/deps.edn') }} restore-keys: ${{ runner.os }}-m2 - - uses: actions/checkout@v3 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: "npm" - name: Install clojure tools uses: DeLaGuardo/setup-clojure@12.5 @@ -28,11 +33,18 @@ jobs: bb: latest - name: Build static site - run: bb build-static + run: bb release-gh-pages - - name: Deploy - uses: peaceiris/actions-gh-pages@v4 - if: ${{ github.ref == 'refs/heads/main' }} - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./public + - name: Deploy with gh-pages + run: | + git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git + npx gh-pages -d public --dotfiles true -u "github-actions-bot " + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + #- name: Deploy + # uses: peaceiris/actions-gh-pages@v4 + # if: ${{ github.ref == 'refs/heads/main' }} + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # publish_dir: ./public diff --git a/bb.edn b/bb.edn index 20ef88f..7c32932 100644 --- a/bb.edn +++ b/bb.edn @@ -23,12 +23,12 @@ (do (X "clojure -X:dev:nextjournal/clerk") (spit "./public/CNAME" ""))} - release-gh-pages - {:doc "Generate a fresh static build and release it to Github Pages." + build-gh-pages + {:doc "Generate a fresh static build ready to be pushed to Github Pages." :task (do (shell "rm -rf public") - (run 'build-static) - (shell "npm run gh-pages"))} + (shell "npm install") + (run 'build-static))} publish-local {:doc "Generate a fresh static build in the `public` folder and start a local diff --git a/package.json b/package.json index f5def19..2884021 100644 --- a/package.json +++ b/package.json @@ -1,43 +1,42 @@ { - "dependencies": { - "@codemirror/autocomplete": "^6.0.2", - "@codemirror/commands": "^6.0.0", - "@codemirror/lang-markdown": "6.0.0", - "@codemirror/language": "^6.1.0", - "@codemirror/lint": "^6.0.0", - "@codemirror/search": "^6.0.0", - "@codemirror/state": "^6.0.1", - "@codemirror/view": "^6.0.2", - "@lezer/common": "^1.0.0", - "@lezer/generator": "^1.0.0", - "@lezer/highlight": "^1.0.0", - "@lezer/lr": "^1.0.0", - "@lezer/markdown": "^1.0.0", - "@nextjournal/lang-clojure": "^1.0.0", - "@nextjournal/lezer-clojure": "1.0.0", - "d3-require": "^1.2.4", - "emoji-regex": "^10.0.0", - "framer-motion": "^10.12.16", - "gh-pages": "^3.2.3", - "http-server": "^14.1.1", - "katex": "^0.12.0", - "lezer-clojure": "1.0.0-rc.2", - "markdown-it": "^12.2.0", - "markdown-it-block-image": "^0.0.3", - "markdown-it-footnote": "^3.0.3", - "markdown-it-texmath": "^1.0.0", - "markdown-it-toc-done-right": "^4.2.0", - "punycode": "2.1.1", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "shadow-cljs": "2.28.8", - "use-sync-external-store": "^1.2.0", - "vh-sticky-table-header": "^1.2.1", - "w3c-keyname": "2.2.4", - "p5": "^1.9.4" - }, - "scripts": { - "gh-pages": "gh-pages -d public --dotfiles true", - "serve": "http-server -c-1 -o -p 8080" - } + "dependencies": { + "@codemirror/autocomplete": "^6.0.2", + "@codemirror/commands": "^6.0.0", + "@codemirror/lang-markdown": "6.0.0", + "@codemirror/language": "^6.1.0", + "@codemirror/lint": "^6.0.0", + "@codemirror/search": "^6.0.0", + "@codemirror/state": "^6.0.1", + "@codemirror/view": "^6.0.2", + "@lezer/common": "^1.0.0", + "@lezer/generator": "^1.0.0", + "@lezer/highlight": "^1.0.0", + "@lezer/lr": "^1.0.0", + "@lezer/markdown": "^1.0.0", + "@nextjournal/lang-clojure": "^1.0.0", + "@nextjournal/lezer-clojure": "1.0.0", + "d3-require": "^1.2.4", + "emoji-regex": "^10.0.0", + "framer-motion": "^10.12.16", + "gh-pages": "^6.1.1", + "http-server": "^14.1.1", + "katex": "^0.12.0", + "lezer-clojure": "1.0.0-rc.2", + "markdown-it": "^12.2.0", + "markdown-it-block-image": "^0.0.3", + "markdown-it-footnote": "^3.0.3", + "markdown-it-texmath": "^1.0.0", + "markdown-it-toc-done-right": "^4.2.0", + "punycode": "2.1.1", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "shadow-cljs": "2.28.8", + "use-sync-external-store": "^1.2.0", + "vh-sticky-table-header": "^1.2.1", + "w3c-keyname": "2.2.4", + "p5": "^1.9.4" + }, + "scripts": { + "serve": "http-server -c-1 -o -p 8080" + } }