test: cover Cursor-runtime branches in hook-runtime (98.3% coverage) #5
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: release-prod | |
| on: | |
| push: | |
| branches: [main] | |
| # Production release: every merge to `main` cuts a stable release IF the | |
| # package.json version was bumped. If the tag already exists (no version | |
| # bump), the release step is skipped — lints + tests still run. | |
| # | |
| # Tag prefix is `cursor-v` (claude-code-lua-plugin uses `v`) to keep the two | |
| # repos' tags from colliding when cross-referenced. | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install plugin deps | |
| run: npm ci | |
| - name: Lint | |
| run: npm run lint | |
| - name: Test plugin | |
| run: npm test -- --coverage | |
| - name: Verify per-file coverage gate | |
| run: node scripts/check-coverage.mjs | |
| - name: Install MCP deps | |
| working-directory: mcp/lua-platform | |
| run: npm ci | |
| - name: Test MCP | |
| working-directory: mcp/lua-platform | |
| run: npm test | |
| - name: Build MCP bundle | |
| working-directory: mcp/lua-platform | |
| run: npm run build | |
| - name: Verify bundle size | |
| run: node scripts/check-bundle-size.mjs | |
| - name: Read version from package.json | |
| id: version | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| if [[ "${VERSION}" == *"-beta"* || "${VERSION}" == *"-rc"* || "${VERSION}" == *"-alpha"* ]]; then | |
| echo "::error::Production release requires a stable version in package.json (no -beta/-rc/-alpha suffix). Got: ${VERSION}" | |
| exit 1 | |
| fi | |
| echo "tag=cursor-v${VERSION}" >> "$GITHUB_OUTPUT" | |
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | |
| echo "Production version: ${VERSION}" | |
| - name: Check if tag already exists | |
| id: tag_check | |
| run: | | |
| if git rev-parse "${{ steps.version.outputs.tag }}" >/dev/null 2>&1; then | |
| echo "Tag ${{ steps.version.outputs.tag }} already exists — no version bump in this push, skipping release. (Lints + tests still ran.)" | |
| echo "skip=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "skip=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Build release tarball | |
| if: steps.tag_check.outputs.skip != 'true' | |
| run: | | |
| node scripts/pack.mjs | |
| TARBALL="cursor-lua-agent-builder-${{ steps.version.outputs.version }}.tar.gz" | |
| ls -lh "${TARBALL}" | |
| echo "TARBALL=${TARBALL}" >> "$GITHUB_ENV" | |
| - name: Create GitHub release | |
| if: steps.tag_check.outputs.skip != 'true' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.version.outputs.tag }} | |
| name: ${{ steps.version.outputs.tag }} | |
| prerelease: false | |
| generate_release_notes: true | |
| target_commitish: main | |
| files: ${{ env.TARBALL }} |