|
9 | 9 |
|
10 | 10 | permissions: |
11 | 11 | contents: write |
| 12 | + pull-requests: write |
12 | 13 |
|
13 | 14 | concurrency: |
14 | 15 | group: auto-tag-${{ github.ref }} |
15 | 16 | cancel-in-progress: false |
16 | 17 |
|
17 | 18 | jobs: |
18 | 19 | create-tag: |
19 | | - name: Create and Push Tag |
20 | | - # Only run when a release/* branch was actually merged (not just closed) |
| 20 | + name: Create Tag and Sync Development |
21 | 21 | if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/') |
22 | 22 | runs-on: ubuntu-latest |
23 | | - timeout-minutes: 5 |
| 23 | + timeout-minutes: 10 |
24 | 24 |
|
25 | 25 | steps: |
26 | 26 | - name: Checkout repository |
|
54 | 54 | -m "Release ${{ steps.version.outputs.version }}" |
55 | 55 | git push origin "${{ steps.version.outputs.tag }}" |
56 | 56 | echo "::notice::Tag ${{ steps.version.outputs.tag }} pushed successfully." |
| 57 | +
|
| 58 | + - name: Cherry-pick release commit into development |
| 59 | + if: steps.check.outputs.exists == 'false' |
| 60 | + env: |
| 61 | + GH_TOKEN: ${{ secrets.PAT_TOKEN }} |
| 62 | + run: | |
| 63 | + set -euo pipefail |
| 64 | +
|
| 65 | + RELEASE_SHA="${{ github.event.pull_request.head.sha }}" |
| 66 | + VERSION="${{ steps.version.outputs.version }}" |
| 67 | +
|
| 68 | + git config user.name "github-actions[bot]" |
| 69 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 70 | +
|
| 71 | + git fetch origin development |
| 72 | + git checkout -B development origin/development |
| 73 | +
|
| 74 | + if git cherry-pick "$RELEASE_SHA"; then |
| 75 | + git push origin development |
| 76 | + echo "::notice::Cherry-pick of $RELEASE_SHA into development succeeded." |
| 77 | + else |
| 78 | + git cherry-pick --abort |
| 79 | +
|
| 80 | + SYNC_BRANCH="chore/sync-release-${VERSION}-to-development" |
| 81 | + git checkout -B "$SYNC_BRANCH" origin/development |
| 82 | + git push origin "$SYNC_BRANCH" |
| 83 | +
|
| 84 | + gh pr create \ |
| 85 | + --base development \ |
| 86 | + --head "$SYNC_BRANCH" \ |
| 87 | + --title "chore: sync release ${VERSION} into development" \ |
| 88 | + --body "$(printf 'Automatic cherry-pick of release \`%s\` (commit \`%s\`) into \`development\` failed due to conflicts.\n\nPlease apply and resolve manually:\n\n```\ngit fetch origin\ngit checkout %s\ngit cherry-pick %s\n# resolve conflicts\ngit push origin %s\n```' \ |
| 89 | + "$VERSION" "$RELEASE_SHA" "$SYNC_BRANCH" "$RELEASE_SHA" "$SYNC_BRANCH")" |
| 90 | +
|
| 91 | + echo "::warning::Cherry-pick conflict. PR created: $SYNC_BRANCH → development." |
| 92 | + fi |
0 commit comments