chore: sync hive #128
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 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| concurrency: ${{ github.workflow }}-${{ github.ref }} | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - uses: oven-sh/setup-bun@v2 | |
| - name: Setup npmrc | |
| run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Build packages | |
| run: bun turbo build --filter='./packages/*' | |
| - name: Read changesets | |
| id: changesets_content | |
| run: | | |
| CONTENT="" | |
| for f in .changeset/*.md; do | |
| [ -f "$f" ] || continue | |
| [ "$(basename "$f")" = "README.md" ] && continue | |
| CONTENT="$CONTENT$(cat "$f")\n\n" | |
| done | |
| if [ -z "$CONTENT" ]; then | |
| echo "has_changesets=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "has_changesets=true" >> $GITHUB_OUTPUT | |
| echo "content<<EOF" >> $GITHUB_OUTPUT | |
| echo -e "$CONTENT" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Generate PR title with AI | |
| if: steps.changesets_content.outputs.has_changesets == 'true' | |
| id: pr_title | |
| uses: vercel/ai-action@v2 | |
| with: | |
| model: "anthropic/claude-haiku-4-5" | |
| api-key: ${{ secrets.AI_GATEWAY_API_KEY }} | |
| prompt: | | |
| Generate a concise PR title (max 60 chars) for this release. Rules: | |
| - Start with "release: " prefix | |
| - Then lowercase verb (add, fix, improve, etc) | |
| - Be specific about what changed | |
| - No version numbers | |
| - Output ONLY the title, nothing else | |
| Example: "release: add react hooks and router package" | |
| Changesets: | |
| ${{ steps.changesets_content.outputs.content }} | |
| - name: Set PR title | |
| id: final_title | |
| run: | | |
| TITLE="${{ steps.pr_title.outputs.text }}" | |
| if [ -z "$TITLE" ]; then | |
| TITLE="chore: update versions" | |
| fi | |
| echo "title=$TITLE" >> $GITHUB_OUTPUT | |
| - name: Create and publish versions | |
| uses: changesets/action@v1 | |
| with: | |
| version: bun run ci:version | |
| commit: ${{ steps.final_title.outputs.title }} | |
| title: ${{ steps.final_title.outputs.title }} | |
| publish: bun run ci:publish | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |