Merge pull request #122 from datum-cloud/changeset-release/main #79
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: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| id-token: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: pnpm | |
| registry-url: https://registry.npmjs.org | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build packages | |
| run: pnpm build | |
| - name: Generate PR description | |
| id: pr-body | |
| run: | | |
| BODY=$(.github/scripts/generate-version-pr-body.sh) | |
| echo "body<<EOF" >> $GITHUB_OUTPUT | |
| echo "$BODY" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| # Determine title suffix based on bump type | |
| if grep -q "Release Type: \`major\`" <<< "$BODY"; then | |
| echo "title-suffix=(major)" >> $GITHUB_OUTPUT | |
| elif grep -q "Release Type: \`minor\`" <<< "$BODY"; then | |
| echo "title-suffix=(minor)" >> $GITHUB_OUTPUT | |
| elif grep -q "Release Type: \`patch\`" <<< "$BODY"; then | |
| echo "title-suffix=(patch)" >> $GITHUB_OUTPUT | |
| else | |
| echo "title-suffix=" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create Release Pull Request or Publish | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| version: pnpm changeset version | |
| publish: pnpm changeset publish | |
| commit: "chore: version packages" | |
| title: "chore: version packages ${{ steps.pr-body.outputs.title-suffix }}" | |
| createGithubReleases: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Update PR description | |
| if: steps.changesets.outputs.pullRequestNumber != '' | |
| run: | | |
| gh pr edit ${{ steps.changesets.outputs.pullRequestNumber }} \ | |
| --body "${{ steps.pr-body.outputs.body }}" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |