|
1 | | -name: Release Tag |
| 1 | +name: Release PR |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | workflow_dispatch: |
|
15 | 15 |
|
16 | 16 | permissions: |
17 | 17 | contents: write |
| 18 | + pull-requests: write |
18 | 19 |
|
19 | 20 | jobs: |
20 | 21 | release: |
21 | 22 | runs-on: ubuntu-latest |
22 | 23 | steps: |
23 | 24 | - name: Ensure main branch |
24 | 25 | run: test "${{ github.ref_name }}" = "main" |
| 26 | + |
25 | 27 | - name: Checkout |
26 | 28 | uses: actions/checkout@v4 |
27 | 29 | with: |
@@ -53,14 +55,31 @@ jobs: |
53 | 55 | git config user.name "github-actions[bot]" |
54 | 56 | git config user.email "github-actions[bot]@users.noreply.github.com" |
55 | 57 |
|
56 | | - - name: Bump version and create tag |
| 58 | + - name: Bump version |
57 | 59 | id: bump |
58 | 60 | run: | |
59 | | - NEW_VERSION=$(npm version ${{ github.event.inputs.bump }} -m "chore(release): %s [skip ci]") |
60 | | - echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT" |
| 61 | + npm version ${{ github.event.inputs.bump }} --no-git-tag-version |
| 62 | + VERSION="v$(node -p \"require('./package.json').version\")" |
| 63 | + BRANCH="release/${VERSION}" |
| 64 | + echo "version=$VERSION" >> "$GITHUB_OUTPUT" |
| 65 | + echo "branch=$BRANCH" >> "$GITHUB_OUTPUT" |
| 66 | +
|
| 67 | + - name: Commit version bump |
| 68 | + run: | |
| 69 | + git checkout -b "${{ steps.bump.outputs.branch }}" |
| 70 | + git add package.json |
| 71 | + git commit -m "chore(release): ${{ steps.bump.outputs.version }} [skip ci]" |
61 | 72 |
|
62 | | - - name: Push release commit and tag |
63 | | - run: git push origin HEAD:${{ github.ref_name }} --follow-tags |
| 73 | + - name: Push release branch |
| 74 | + run: git push -u origin "${{ steps.bump.outputs.branch }}" |
64 | 75 |
|
65 | | - - name: Release summary |
66 | | - run: echo "Created and pushed ${{ steps.bump.outputs.version }}" |
| 76 | + - name: Create release pull request |
| 77 | + env: |
| 78 | + GH_TOKEN: ${{ github.token }} |
| 79 | + run: | |
| 80 | + gh pr create \ |
| 81 | + --base main \ |
| 82 | + --head "${{ steps.bump.outputs.branch }}" \ |
| 83 | + --title "chore(release): ${{ steps.bump.outputs.version }}" \ |
| 84 | + --body "Automated release bump for ${{ steps.bump.outputs.version }}.\n\n- Verification passed (lint, typecheck, build, test)\n- Merge this PR to create and publish tag automatically" \ |
| 85 | + --assignee "${{ github.actor }}" |
0 commit comments