Skip to content

Commit f817d57

Browse files
authored
Merge pull request #23 from zeroedin/chore/more-brute-force
chore: brute force delete and recreate release branch
2 parents ed491de + 65594e2 commit f817d57

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

.github/workflows/release.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,23 @@ jobs:
3636

3737
- name: Create release branch
3838
run: |
39+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
3940
TAG_NAME="v$PACKAGE_VERSION"
4041
RELEASE_BRANCH="release/${TAG_NAME}"
4142
42-
# Create and push release branch
43+
# Check if branch exists and delete it if it does
44+
if git show-ref --verify --quiet "refs/heads/$RELEASE_BRANCH"; then
45+
echo "Branch $RELEASE_BRANCH already exists, deleting it..."
46+
git branch -D "$RELEASE_BRANCH"
47+
fi
48+
49+
# Check if remote branch exists and delete it if it does
50+
if git show-ref --verify --quiet "refs/remotes/origin/$RELEASE_BRANCH"; then
51+
echo "Remote branch $RELEASE_BRANCH already exists, deleting it..."
52+
git push origin --delete "$RELEASE_BRANCH"
53+
fi
54+
55+
# Create and push new release branch
4356
git checkout -b "$RELEASE_BRANCH"
4457
git push origin "$RELEASE_BRANCH"
4558

0 commit comments

Comments
 (0)