|
1 | | -name: Create Release PR |
| 1 | +name: Create Release |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | workflow_dispatch: |
|
21 | 21 |
|
22 | 22 | permissions: |
23 | 23 | contents: write |
24 | | - pull-requests: write |
25 | 24 |
|
26 | 25 | jobs: |
27 | | - create-release-pr: |
| 26 | + create-release: |
28 | 27 | runs-on: ubuntu-latest |
29 | 28 |
|
30 | 29 | steps: |
31 | 30 | - name: Checkout code |
32 | 31 | uses: actions/checkout@v4 |
33 | 32 | with: |
34 | 33 | fetch-depth: 0 |
35 | | - token: ${{ secrets.GITHUB_TOKEN }} |
36 | 34 |
|
37 | 35 | - name: Set up Ruby |
38 | 36 | uses: ruby/setup-ruby@v1 |
@@ -97,140 +95,51 @@ jobs: |
97 | 95 | echo "=== CHANGELOG PREVIEW ===" |
98 | 96 | bundle exec rake release:changelog[${{ steps.next_version.outputs.NEXT_VERSION }}] || true |
99 | 97 |
|
100 | | - - name: Create release branch |
101 | | - if: ${{ github.event.inputs.dry_run != 'true' }} |
102 | | - run: | |
103 | | - BRANCH_NAME="release/v${{ steps.next_version.outputs.NEXT_VERSION }}" |
104 | | - git checkout -b "$BRANCH_NAME" |
105 | | - echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV |
106 | | -
|
107 | 98 | - name: Run tests before release |
108 | 99 | if: ${{ github.event.inputs.dry_run != 'true' }} |
109 | 100 | run: bundle exec rake ci |
110 | 101 |
|
111 | | - - name: Create release |
| 102 | + - name: Create release and tag |
112 | 103 | if: ${{ github.event.inputs.dry_run != 'true' }} |
113 | 104 | run: | |
| 105 | + echo "🚀 Creating ${{ steps.release_type.outputs.RELEASE_TYPE }} release..." |
114 | 106 | bundle exec rake release:create[${{ steps.release_type.outputs.RELEASE_TYPE }}] |
115 | 107 |
|
116 | | - - name: Push release branch |
| 108 | + - name: Push changes and tag |
117 | 109 | if: ${{ github.event.inputs.dry_run != 'true' }} |
118 | 110 | run: | |
119 | | - git push origin "$BRANCH_NAME" |
120 | | -
|
121 | | - - name: Create Pull Request |
122 | | - if: ${{ github.event.inputs.dry_run != 'true' }} |
123 | | - id: create_pr |
124 | | - uses: actions/github-script@v7 |
125 | | - with: |
126 | | - script: | |
127 | | - const { data: pr } = await github.rest.pulls.create({ |
128 | | - owner: context.repo.owner, |
129 | | - repo: context.repo.repo, |
130 | | - title: `Release v${{ steps.next_version.outputs.NEXT_VERSION }}`, |
131 | | - head: process.env.BRANCH_NAME, |
132 | | - base: 'main', |
133 | | - body: `## Release v${{ steps.next_version.outputs.NEXT_VERSION }} |
134 | | -
|
135 | | - This is an automated release PR created by GitHub Actions. |
136 | | -
|
137 | | - ### Release Type: ${{ steps.release_type.outputs.RELEASE_TYPE }} |
138 | | -
|
139 | | - ### Changes |
140 | | -
|
141 | | - This PR includes: |
142 | | - - 📝 Updated CHANGELOG.md with new version |
143 | | - - 🏷️ Version tag v${{ steps.next_version.outputs.NEXT_VERSION }} |
144 | | - - ✅ All tests passing |
145 | | -
|
146 | | - ### What happens when merged? |
147 | | -
|
148 | | - When this PR is merged to main: |
149 | | - 1. 🚀 GitHub Actions will automatically create a GitHub release |
150 | | - 2. 📦 Release artifacts will be built and attached |
151 | | - 3. 🌐 Release will be published |
152 | | -
|
153 | | - ### Review Checklist |
154 | | -
|
155 | | - - [ ] Review the changelog entries |
156 | | - - [ ] Verify the version bump is appropriate |
157 | | - - [ ] Confirm all tests are passing |
158 | | - - [ ] Check that no sensitive information is included |
159 | | -
|
160 | | - --- |
161 | | -
|
162 | | - *This PR was created automatically by the [Create Release PR workflow](.github/workflows/create-release-pr.yml)*`, |
163 | | - draft: false |
164 | | - }); |
165 | | -
|
166 | | - // Add labels |
167 | | - await github.rest.issues.addLabels({ |
168 | | - owner: context.repo.owner, |
169 | | - repo: context.repo.repo, |
170 | | - issue_number: pr.number, |
171 | | - labels: ['release', '${{ steps.release_type.outputs.RELEASE_TYPE }}'] |
172 | | - }); |
173 | | -
|
174 | | - console.log(`Created PR #${pr.number}: ${pr.html_url}`); |
175 | | -
|
176 | | - // Set outputs |
177 | | - core.setOutput('pr_number', pr.number); |
178 | | - core.setOutput('pr_url', pr.html_url); |
179 | | -
|
180 | | - return { |
181 | | - pr_number: pr.number, |
182 | | - pr_url: pr.html_url |
183 | | - }; |
184 | | -
|
185 | | - - name: Comment on PR with details |
186 | | - if: ${{ github.event.inputs.dry_run != 'true' }} |
187 | | - uses: actions/github-script@v7 |
188 | | - with: |
189 | | - script: | |
190 | | - const prNumber = ${{ steps.create_pr.outputs.pr_number }}; |
191 | | -
|
192 | | - await github.rest.issues.createComment({ |
193 | | - owner: context.repo.owner, |
194 | | - repo: context.repo.repo, |
195 | | - issue_number: prNumber, |
196 | | - body: `### 🚀 Release Summary |
197 | | -
|
198 | | - | Item | Value | |
199 | | - |------|-------| |
200 | | - | **Current Version** | ${{ steps.current_version.outputs.CURRENT_VERSION }} | |
201 | | - | **New Version** | ${{ steps.next_version.outputs.NEXT_VERSION }} | |
202 | | - | **Release Type** | ${{ steps.release_type.outputs.RELEASE_TYPE }} | |
203 | | - | **Branch** | \`${process.env.BRANCH_NAME}\` | |
| 111 | + VERSION_TAG="v${{ steps.next_version.outputs.NEXT_VERSION }}" |
| 112 | + echo "📤 Pushing changes and tag $VERSION_TAG to GitHub..." |
204 | 113 |
|
205 | | - ### 📋 Next Steps |
| 114 | + # Push any changelog changes |
| 115 | + git push origin main |
206 | 116 |
|
207 | | - 1. **Review** the changes in this PR |
208 | | - 2. **Merge** this PR to trigger the release |
209 | | - 3. **Monitor** the release workflow in the Actions tab |
| 117 | + # Push the version tag (this will trigger the release.yml workflow) |
| 118 | + git push origin "$VERSION_TAG" |
210 | 119 |
|
211 | | - The release will be automatically created when this PR is merged! 🎉` |
212 | | - }); |
| 120 | + echo "✅ Successfully pushed tag $VERSION_TAG" |
| 121 | + echo "🎯 The release.yml workflow will now create the GitHub release automatically" |
213 | 122 |
|
214 | 123 | - name: Output summary |
215 | 124 | if: ${{ github.event.inputs.dry_run != 'true' }} |
216 | 125 | run: | |
217 | | - echo "## Release PR Created! 🎉" >> $GITHUB_STEP_SUMMARY |
| 126 | + echo "## Release Created! 🎉" >> $GITHUB_STEP_SUMMARY |
218 | 127 | echo "" >> $GITHUB_STEP_SUMMARY |
219 | | - echo "- **Version**: ${{ steps.next_version.outputs.NEXT_VERSION }}" >> $GITHUB_STEP_SUMMARY |
| 128 | + echo "- **Version**: v${{ steps.next_version.outputs.NEXT_VERSION }}" >> $GITHUB_STEP_SUMMARY |
220 | 129 | echo "- **Type**: ${{ steps.release_type.outputs.RELEASE_TYPE }}" >> $GITHUB_STEP_SUMMARY |
221 | | - echo "- **Branch**: $BRANCH_NAME" >> $GITHUB_STEP_SUMMARY |
222 | | - echo "- **PR**: ${{ steps.create_pr.outputs.pr_url }}" >> $GITHUB_STEP_SUMMARY |
| 130 | + echo "- **Tag**: v${{ steps.next_version.outputs.NEXT_VERSION }}" >> $GITHUB_STEP_SUMMARY |
223 | 131 | echo "" >> $GITHUB_STEP_SUMMARY |
224 | | - echo "### What's Next?" >> $GITHUB_STEP_SUMMARY |
225 | | - echo "1. Review and merge the PR" >> $GITHUB_STEP_SUMMARY |
226 | | - echo "2. The release will be automatically created" >> $GITHUB_STEP_SUMMARY |
| 132 | + echo "### What happens next?" >> $GITHUB_STEP_SUMMARY |
| 133 | + echo "1. 🚀 The release.yml workflow is now running" >> $GITHUB_STEP_SUMMARY |
| 134 | + echo "2. 📦 GitHub release will be created automatically" >> $GITHUB_STEP_SUMMARY |
| 135 | + echo "3. 🌐 Monitor progress at: https://github.com/${{ github.repository }}/actions" >> $GITHUB_STEP_SUMMARY |
227 | 136 |
|
228 | 137 | - name: Output dry run summary |
229 | 138 | if: ${{ github.event.inputs.dry_run == 'true' }} |
230 | 139 | run: | |
231 | 140 | echo "## Dry Run Complete! 👀" >> $GITHUB_STEP_SUMMARY |
232 | 141 | echo "" >> $GITHUB_STEP_SUMMARY |
233 | | - echo "- **Would create version**: ${{ steps.next_version.outputs.NEXT_VERSION }}" >> $GITHUB_STEP_SUMMARY |
| 142 | + echo "- **Would create version**: v${{ steps.next_version.outputs.NEXT_VERSION }}" >> $GITHUB_STEP_SUMMARY |
234 | 143 | echo "- **Release type**: ${{ steps.release_type.outputs.RELEASE_TYPE }}" >> $GITHUB_STEP_SUMMARY |
235 | 144 | echo "" >> $GITHUB_STEP_SUMMARY |
236 | 145 | echo "To create the actual release, run this workflow again without dry run mode." >> $GITHUB_STEP_SUMMARY |
0 commit comments