chore: run npm pkg fix to normalize package.json fields (#2) #7
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 + Auto Tag | |
| on: | |
| push: | |
| branches: [main] | |
| jobs: | |
| ci-and-tag: | |
| name: Test, Build & Tag | |
| runs-on: ubuntu-latest | |
| if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm install --include=dev | |
| - name: Type check | |
| run: npx tsc --noEmit | |
| - name: Test | |
| run: npm test | |
| - name: Build | |
| run: npm run build | |
| - name: Tag HEAD with next patch version | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| # Determine next version from latest git tag (fallback to package.json) | |
| LATEST=$(git tag -l 'v*' --sort=-version:refname | head -1) | |
| if [ -z "$LATEST" ]; then | |
| LATEST="v$(node -p "require('./package.json').version")" | |
| fi | |
| CURRENT="${LATEST#v}" | |
| IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT" | |
| NEW_VERSION="$MAJOR.$MINOR.$((PATCH + 1))" | |
| git tag "v$NEW_VERSION" | |
| git push origin "v$NEW_VERSION" | |
| echo "Tagged HEAD as v$NEW_VERSION" |