chore(release): 3.2.14 #421
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 | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| id-token: write | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.event.head_commit.message, 'chore(release):') | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Extract version from commit message | |
| id: version | |
| run: | | |
| VERSION=$(echo "${{ github.event.head_commit.message }}" | sed -E 's/^chore\(release\): //') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Create and push tag | |
| if: steps.version.outputs.version != '' | |
| run: | | |
| git config --local user.email "[email protected]" | |
| git config --local user.name "Aman Varshney" | |
| # Check if tag exists before creating | |
| if ! git rev-parse "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then | |
| git tag -a "v${{ steps.version.outputs.version }}" -m "Release v${{ steps.version.outputs.version }}" | |
| git push --tags | |
| else | |
| echo "Tag v${{ steps.version.outputs.version }} already exists, skipping creation" | |
| fi | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| if: steps.version.outputs.version != '' | |
| with: | |
| bun-version: latest | |
| - name: Install Dependencies | |
| if: steps.version.outputs.version != '' | |
| run: bun install --frozen-lockfile | |
| env: | |
| BTS_TELEMETRY: 1 | |
| POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} | |
| POSTHOG_HOST: ${{ secrets.POSTHOG_HOST }} | |
| - name: Build CLI | |
| if: steps.version.outputs.version != '' | |
| run: cd apps/cli && bun run build | |
| env: | |
| BTS_TELEMETRY: 1 | |
| POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} | |
| POSTHOG_HOST: ${{ secrets.POSTHOG_HOST }} | |
| - name: Create GitHub Release | |
| if: steps.version.outputs.version != '' | |
| run: | | |
| # Check if release exists before creating | |
| if ! gh release view "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then | |
| bunx changelogithub | |
| else | |
| echo "Release v${{ steps.version.outputs.version }} already exists, skipping creation" | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Update create-bts alias package version | |
| if: steps.version.outputs.version != '' | |
| run: | | |
| VERSION=${{ steps.version.outputs.version }} | |
| cd packages/create-bts | |
| bun run node -e "const pkg=require('./package.json');pkg.version='$VERSION';pkg.dependencies['create-better-t-stack']='^$VERSION';require('fs').writeFileSync('package.json',JSON.stringify(pkg,null,2)+'\n')" | |
| - name: Publish CLI to NPM | |
| if: steps.version.outputs.version != '' | |
| run: cd apps/cli && bun publish --access public | |
| env: | |
| NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| BTS_TELEMETRY: 1 | |
| POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} | |
| POSTHOG_HOST: ${{ secrets.POSTHOG_HOST }} | |
| - name: Publish create-bts alias to NPM | |
| if: steps.version.outputs.version != '' | |
| run: cd packages/create-bts && bun publish --access public | |
| env: | |
| NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| BTS_TELEMETRY: 1 | |
| POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} | |
| POSTHOG_HOST: ${{ secrets.POSTHOG_HOST }} |