fix: entry point for non-scoped bin package #9
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 and Publish | |
| on: | |
| push: | |
| branches: [main, load-docs] | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9.14.2 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: "22" | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Install platform-specific dependencies | |
| run: | | |
| # Install platform dependencies for Linux (temporary, not saved to package.json) | |
| pnpm add @oxlint/linux-x64-gnu --save-dev || echo "Failed to install oxlint platform dependency, continuing..." | |
| - name: Check formatting | |
| run: pnpm run format:check:all | |
| - name: Run linting | |
| run: pnpm run lint:all | |
| - name: Build project | |
| run: pnpm run build | |
| - name: Run tests | |
| run: pnpm test | |
| env: | |
| LOG_LEVEL: ERROR | |
| release: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Generate GitHub App Token | |
| id: generate_token | |
| uses: tibdex/github-app-token@v1 | |
| with: | |
| app_id: ${{ vars.VERSION_BUMPER_APPID }} | |
| private_key: ${{ secrets.VERSION_BUMPER_SECRET }} | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ steps.generate_token.outputs.token }} | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9.14.2 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: "22" | |
| cache: "pnpm" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Install platform-specific dependencies | |
| run: | | |
| # Install platform dependencies for Linux CI environment (temporary, not saved to package.json) | |
| pnpm add @oxlint/linux-x64-gnu --save-dev || echo "Failed to install oxlint platform dependency" | |
| - name: Build project | |
| run: pnpm run build | |
| - name: Bump version and create tag | |
| id: version | |
| uses: mathieudutour/github-tag-action@v6.2 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| default_bump: patch | |
| tag_prefix: v | |
| - name: Update package.json version | |
| if: steps.version.outputs.new_tag | |
| run: | | |
| NEW_VERSION=${{ steps.version.outputs.new_version }} | |
| # Update root package.json | |
| pnpm version $NEW_VERSION --no-git-tag-version | |
| # Update all workspace package versions | |
| pnpm -r exec pnpm version $NEW_VERSION --no-git-tag-version | |
| # Ensure no platform-specific dependencies were accidentally saved | |
| pnpm remove @oxlint/linux-x64-gnu 2>/dev/null || true | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add package.json packages/*/package.json pnpm-lock.yaml | |
| git commit -m "chore: bump version to $NEW_VERSION [skip ci]" || exit 0 | |
| git push | |
| env: | |
| GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | |
| - name: Create GitHub Release | |
| if: steps.version.outputs.new_tag | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ steps.version.outputs.new_tag }} | |
| name: Release ${{ steps.version.outputs.new_tag }} | |
| body: ${{ steps.version.outputs.changelog }} | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish to npm | |
| if: steps.version.outputs.new_tag | |
| run: | | |
| # Publish core package first as other packages depend on it | |
| cd packages/core | |
| pnpm publish --access public --no-git-checks | |
| cd ../.. | |
| # Publish content-loader package | |
| cd packages/content-loader | |
| pnpm publish --access public --no-git-checks | |
| cd ../.. | |
| # Publish MCP server as standalone package | |
| cd packages/mcp-server | |
| pnpm publish --access public --no-git-checks | |
| cd ../.. | |
| # Convert workspace dependencies to actual versions for publishing | |
| NEW_VERSION=${{ steps.version.outputs.new_version }} | |
| find packages -name "package.json" -exec sed -i 's/"workspace:\*"/"^'$NEW_VERSION'"/g' {} \; | |
| # Publish main package | |
| pnpm publish --access public --no-git-checks | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |