diff --git a/.github/workflows/build-website.yml b/.github/workflows/build-website.yml index 9d85627d..dca9a97b 100644 --- a/.github/workflows/build-website.yml +++ b/.github/workflows/build-website.yml @@ -1,9 +1,11 @@ -name: Deploy Site to GitHub Pages +name: Build and test site on: push: branches: - main + pull_request: + jobs: build: name: Build Astro site @@ -16,29 +18,39 @@ 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 + - name: Upload html output as artifact + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.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 }} + name: html-${{ github.run_id }} + path: ./dist + link_check: + name: Check internal links runs-on: ubuntu-latest + needs: build steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5 + - 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: 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