Refactor ci #33
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and test site | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| jobs: | |
| build: | |
| name: Build Astro site | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: /actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 | |
| with: | |
| node-version: 23 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - 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: | |
| name: Check internal links | |
| 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: 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 |