Skip to content

update readme with JSR install instructions, add support for test cov… #4

update readme with JSR install instructions, add support for test cov…

update readme with JSR install instructions, add support for test cov… #4

Workflow file for this run

name: Publish
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 10.6.3
- name: Install dependencies
run: pnpm install
- name: Run tests with coverage
run: pnpm test:coverage
- name: Run type checking
run: pnpm typecheck
- name: Generate coverage badge
run: |
COVERAGE=$(cat coverage/coverage-summary.json | jq -r '.total.lines.pct')
COLOR=$(
if (( $(echo "$COVERAGE >= 90" | bc -l) )); then
echo "brightgreen"
elif (( $(echo "$COVERAGE >= 80" | bc -l) )); then
echo "green"
elif (( $(echo "$COVERAGE >= 70" | bc -l) )); then
echo "yellowgreen"
elif (( $(echo "$COVERAGE >= 60" | bc -l) )); then
echo "yellow"
else
echo "red"
fi
)
echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV
echo "COVERAGE_COLOR=$COLOR" >> $GITHUB_ENV
mkdir -p .github/badges
curl -o .github/badges/coverage.svg "https://img.shields.io/badge/coverage-$COVERAGE%25-$COLOR"
- name: Commit coverage badge
uses: EndBug/add-and-commit@v9
with:
add: ".github/badges/coverage.svg"
message: "chore: update coverage badge [skip ci]"
default_author: github_actions
- name: Publish package
run: npx jsr publish