publint validates the publishable artifact (dist/ vs package.json), not the source. It should run only at publish time, in the CI publish job, not on every commit. - Rename check:publint -> publish:publint - Remove from 'check' chain - Add 'publish:publint' as a step in the CI publish job, right before 'npm publish' - Introduce a 'publish:' script prefix for publish-time-only scripts - Document the prefix convention (check:, fix:, test:, publish:) in project-specs.md (as a top-level subsection under Scripts) and in the README - Add 'publint' and 'stricter' to cspell word list A new script should pick the prefix that matches its lifecycle, not invent a new one. The 'publish:' prefix has no 'npm run publish' aggregator by design (publishing is CI-only).
45 lines
1.2 KiB
YAML
45 lines
1.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
workflow_dispatch: {}
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: .node-version
|
|
cache: "npm"
|
|
- run: npm ci
|
|
- run: npm run build
|
|
- run: npm run check
|
|
- run: npm run test:ci
|
|
- name: Upload coverage
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: coverage
|
|
path: coverage
|
|
|
|
publish:
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: .node-version
|
|
registry-url: "https://registry.npmjs.org/"
|
|
- run: npm ci
|
|
- run: npm run build
|
|
- run: npm run publish:publint
|
|
- run: npm publish --access public
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|