ci: pin node for jsdom tests
All checks were successful
Deploy to Frontend Servers / deploy (push) Successful in 1m28s

This commit is contained in:
TerryM
2026-05-16 21:12:48 +08:00
parent 1c1ef4801b
commit 5b67279734
5 changed files with 610 additions and 87 deletions

View File

@@ -16,27 +16,28 @@ on:
## CI/deploy steps
1. Checkout code.
2. Install dependencies with `npm ci`.
3. Type check with `npx tsc --noEmit`.
4. Check formatting with `npm run format:check`.
5. Run tests with `npm test`.
6. Build with `npm run build` using:
2. Set up Node.js 22 with `actions/setup-node`.
3. Install dependencies with `npm ci`.
4. Type check with `npx tsc --noEmit`.
5. Check formatting with `npm run format:check`.
6. Run tests with `npm test`.
7. Build with `npm run build` using:
```bash
VITE_API_URL=https://api.ark-library.com
VITE_DISABLE_ADMIN=true
```
7. Configure SSH key from `DEPLOY_KEY` secret.
8. `rsync --delete` built `dist/` to both frontend servers:
8. Configure SSH key from `DEPLOY_KEY` secret.
9. `rsync --delete` built `dist/` to both frontend servers:
```text
ec2-user@FRONTEND_1_HOST:/var/www/ark-library/
ec2-user@FRONTEND_2_HOST:/var/www/ark-library/
```
9. Verify both servers have matching `index.html` SHA-256 checksums.
10. Remove temporary SSH key.
10. Verify both servers have matching `index.html` SHA-256 checksums.
11. Remove temporary SSH key.
## Required repository secrets
@@ -48,6 +49,12 @@ The workflow expects these Gitea secrets:
## Common failures
### Node version is too old
The workflow pins Node.js 22 using `actions/setup-node`. This keeps the self-hosted runner from using an older system Node version during `npm ci`, tests, and build.
If `actions/setup-node` cannot run on the self-hosted runner, upgrade the runner host's Node.js installation to Node 22 or at least Node 20.19 before restarting the runner service.
### TypeScript fails on unused imports
This repo uses `noUnusedLocals` and `noUnusedParameters`. Remove unused imports/variables and rerun: