From 9a7f20381b93b247d6faf20ed9aa63941871dcd7 Mon Sep 17 00:00:00 2001 From: Jim Madge Date: Mon, 24 Nov 2025 13:52:40 +0000 Subject: [PATCH 1/5] Don't deploy to GitHub pages --- .github/workflows/build-website.yml | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/.github/workflows/build-website.yml b/.github/workflows/build-website.yml index 9d85627d..c1dca510 100644 --- a/.github/workflows/build-website.yml +++ b/.github/workflows/build-website.yml @@ -16,29 +16,8 @@ jobs: with: node-version: 23 cache: npm - - name: Install dependencies run: npm ci - name: Build website run: | npm run build - ls dist/ - - - name: Upload Build Artifact - uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0 - with: - path: dist/ - deploy: - name: Deploy to GitHub Pages - needs: build - permissions: - pages: write - id-token: write - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5 From 21246b034aac6d1908dd56fa6da404e9a7d0fa15 Mon Sep 17 00:00:00 2001 From: Jim Madge Date: Mon, 24 Nov 2025 16:08:55 +0000 Subject: [PATCH 2/5] Move link check to a job dependent on build --- .github/workflows/build-website.yml | 30 ++++++++++++++++++++++++ .github/workflows/offline-link-check.yml | 21 ----------------- 2 files changed, 30 insertions(+), 21 deletions(-) delete mode 100644 .github/workflows/offline-link-check.yml diff --git a/.github/workflows/build-website.yml b/.github/workflows/build-website.yml index c1dca510..2000f1d7 100644 --- a/.github/workflows/build-website.yml +++ b/.github/workflows/build-website.yml @@ -21,3 +21,33 @@ jobs: - name: Build website run: | npm run build + - name: Upload html output as artifact + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 + with: + name: html-${{ github.run_id }} + path: ./dist + link_check: + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout lychee config file from repository + uses: actions/checkout@v5 + with: + sparse-checkout: | + lychee.toml + sparse-checkout-cone-mode: false + - name: Ensure destination folder exists + run: | + mkdir ./dist + - name: Download html files from artifact + uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 + with: + name: book-html-${{ github.run_id }} + path: ./dist + - name: Offline link check + uses: lycheeverse/lychee-action@v2 + with: + # Only check local files, no network requests + args: --config './lychee.toml' --no-progress --offline --root-dir "$GITHUB_WORKSPACE/dist/" dist/**/*.html + # Fail job when lychee returns a non-zero exit code + fail: true diff --git a/.github/workflows/offline-link-check.yml b/.github/workflows/offline-link-check.yml deleted file mode 100644 index aefc606c..00000000 --- a/.github/workflows/offline-link-check.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Offline link check - -on: - push: - branches: - - main - pull_request: - -jobs: - link_check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v5 - - run: npm ci - - run: npm run build - - uses: lycheeverse/lychee-action@v2 - with: - # Only check local files, no network requests - args: --config './lychee.toml' --no-progress --offline --root-dir "$GITHUB_WORKSPACE/dist/" dist/**/*.html - # Fail job when lychee returns a non-zero exit code - fail: true From 2843d27a8a1f29b71ea889a302f23709dfb2c859 Mon Sep 17 00:00:00 2001 From: Jim Madge Date: Mon, 24 Nov 2025 16:20:31 +0000 Subject: [PATCH 3/5] Run build workflow on PRs --- .github/workflows/build-website.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-website.yml b/.github/workflows/build-website.yml index 2000f1d7..3b1059d1 100644 --- a/.github/workflows/build-website.yml +++ b/.github/workflows/build-website.yml @@ -4,6 +4,8 @@ on: push: branches: - main + pull_request: + jobs: build: name: Build Astro site From 59086a48bffa58db179f1159b3ca20b8a235f514 Mon Sep 17 00:00:00 2001 From: Jim Madge Date: Mon, 24 Nov 2025 16:22:09 +0000 Subject: [PATCH 4/5] Update names --- .github/workflows/build-website.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-website.yml b/.github/workflows/build-website.yml index 3b1059d1..74e94b35 100644 --- a/.github/workflows/build-website.yml +++ b/.github/workflows/build-website.yml @@ -1,4 +1,4 @@ -name: Deploy Site to GitHub Pages +name: Build and test site on: push: @@ -29,6 +29,7 @@ jobs: name: html-${{ github.run_id }} path: ./dist link_check: + name: Check internal links runs-on: ubuntu-latest needs: build steps: From 3ec1734e9318e6fe23ac04ddc8348754fa888264 Mon Sep 17 00:00:00 2001 From: Jim Madge Date: Mon, 24 Nov 2025 16:23:32 +0000 Subject: [PATCH 5/5] Correct artifact name --- .github/workflows/build-website.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-website.yml b/.github/workflows/build-website.yml index 74e94b35..dca9a97b 100644 --- a/.github/workflows/build-website.yml +++ b/.github/workflows/build-website.yml @@ -45,7 +45,7 @@ jobs: - name: Download html files from artifact uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 with: - name: book-html-${{ github.run_id }} + name: html-${{ github.run_id }} path: ./dist - name: Offline link check uses: lycheeverse/lychee-action@v2