CI Integration
GitHub Actions
Add tspub checks to your CI pipeline:
yaml
# .github/workflows/ci.yml
name: CI
on: [push, pull_request]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npx @tspub-dev/tspub build
- run: npx @tspub-dev/tspub check --format json > tspub-report.json
- run: npx @tspub-dev/tspub test-typesJSON Output for CI
Use --format json for machine-readable output:
bash
tspub check --format jsonjson
{
"results": [
{
"severity": "error",
"message": "exports[\".\"].types should come BEFORE import/require/default",
"ruleId": "exports/types-order",
"fixable": "safe"
}
],
"summary": {
"errors": 1,
"warnings": 0,
"passed": 15,
"total": 60
}
}Strict Mode
Fail CI on warnings too:
bash
tspub check --strict
# or
tspub check --profile strictPublish from CI
yaml
- name: Publish
if: github.ref == 'refs/heads/main'
run: npx @tspub-dev/tspub publish --ci
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}With --ci flag, tspub:
- Skips interactive prompts
- Uses
NPM_TOKENfrom environment - Adds
--provenanceif supported - Validates branch protection
Changeset CI Workflow
yaml
- name: Version
if: github.ref == 'refs/heads/main'
run: |
npx @tspub-dev/tspub changeset version
git add .
git commit -m "chore: version packages"
npx @tspub-dev/tspub publish