|
21 | 21 | permissions: |
22 | 22 | contents: write |
23 | 23 | pull-requests: write |
| 24 | + id-token: write |
24 | 25 | steps: |
25 | 26 | - uses: actions/checkout@v4 |
26 | 27 | with: |
@@ -64,12 +65,25 @@ jobs: |
64 | 65 | echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT |
65 | 66 | echo "Current: $CURRENT_VERSION -> New: $NEW_VERSION" |
66 | 67 |
|
67 | | - # Create release branch |
| 68 | + # Create release branch (delete if exists from previous failed run) |
68 | 69 | - name: Create release branch |
69 | 70 | run: | |
70 | 71 | BRANCH_NAME="release/v${{ steps.version.outputs.new_version }}" |
71 | 72 | git config user.name "github-actions[bot]" |
72 | 73 | git config user.email "github-actions[bot]@users.noreply.github.com" |
| 74 | +
|
| 75 | + # Check if branch exists remotely and delete it if it does |
| 76 | + if git ls-remote --heads origin $BRANCH_NAME | grep -q $BRANCH_NAME; then |
| 77 | + echo "Branch $BRANCH_NAME exists remotely, deleting it..." |
| 78 | + git push origin --delete $BRANCH_NAME || true |
| 79 | + fi |
| 80 | +
|
| 81 | + # Check if branch exists locally and delete it if it does |
| 82 | + if git show-ref --verify --quiet refs/heads/$BRANCH_NAME; then |
| 83 | + echo "Branch $BRANCH_NAME exists locally, deleting it..." |
| 84 | + git branch -D $BRANCH_NAME || true |
| 85 | + fi |
| 86 | +
|
73 | 87 | git checkout -b $BRANCH_NAME |
74 | 88 | echo "Created branch: $BRANCH_NAME" |
75 | 89 |
|
|
92 | 106 | token: ${{ secrets.GITHUB_TOKEN }} |
93 | 107 | base: main |
94 | 108 | branch: release/v${{ steps.version.outputs.new_version }} |
| 109 | + delete-branch: false |
| 110 | + push-to-fork: false |
95 | 111 | title: 'Release v${{ steps.version.outputs.new_version }}' |
96 | 112 | body: | |
97 | 113 | ## Release v${{ steps.version.outputs.new_version }} |
|
0 commit comments