ci: add deploy workflow #593
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: ci | |
| on: | |
| pull_request: | |
| branches: | |
| - redesign | |
| - main | |
| pull_request_review: | |
| types: [submitted] | |
| push: | |
| branches: | |
| - redesign | |
| - main | |
| # Cancel in progress workflows | |
| # in the scenario where we already had a run going for that PR/branch/tag but then triggered a new run | |
| concurrency: | |
| group: '${{ github.workflow }} ✨ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-slim | |
| if: | | |
| github.event.pull_request.draft != true && | |
| (github.event_name == 'pull_request_review' && github.event.review.state == 'approved') || | |
| github.event_name != 'pull_request_review' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| # node-version-file: ".nvmrc" use when .nvmrc is on root of the repo | |
| node-version: '24.13' | |
| # cache: "npm" use when package-lock.json is on root of the repo | |
| - name: Install Node.js dependencies | |
| run: npm ci | |
| - name: Run tests | |
| shell: bash | |
| run: npm run check | |
| build: | |
| name: build | |
| runs-on: ubuntu-slim | |
| if: | | |
| github.event.pull_request.draft != true && | |
| (github.event_name == 'pull_request_review' && github.event.review.state == 'approved') || | |
| github.event_name != 'pull_request_review' | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Build Astro site | |
| uses: withastro/action@v6 | |
| with: | |
| path: . | |
| package-manager: npm | |
| out-dir: dist | |
| - name: Upload build artifact for linkChecker | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: site-dist | |
| path: dist/ | |
| if-no-files-found: error | |
| linkChecker: | |
| needs: build | |
| runs-on: ubuntu-slim | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Download build artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: site-dist | |
| path: dist/ | |
| - name: Check links | |
| uses: lycheeverse/lychee-action@a8c4c7cb88f0c7386610c35eb25108e448569cb0 # v2.7.0 | |
| with: | |
| args: | | |
| --root-dir $PWD/dist | |
| --exclude-path dist/llms.txt | |
| --exclude-path dist/llms/ | |
| --remap "https://expressjs\.com\/((?:[^\/]+\/)*[^\/\.]+)\/?$ file://$PWD/dist/\$1/index.html" | |
| --remap "https://expressjs\.com\/(.*\.html)$ file://$PWD/dist/\$1" | |
| dist/ | |
| fail: true |