Skip to content

Commit d1374ae

Browse files
committed
Split up validation into multiple steps
1 parent 00a4a3b commit d1374ae

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

.github/workflows/prepare-release.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,14 @@ jobs:
5050

5151
- name: Validate version
5252
run: |
53-
python scripts/release/validate-version.py "$RELEASE_VERSION"
53+
if [[ "$HOTFIX_RELEASE" == "true" ]]; then
54+
python scripts/release/validate-version.py --hotfix "$RELEASE_VERSION"
55+
else
56+
python scripts/release/validate-version.py "$RELEASE_VERSION"
57+
fi
5458
55-
- name: Validate release precondition
59+
- name: Check if release exists
5660
env:
57-
RELEASE_VERSION: ${{ inputs.version }}
5861
GITHUB_TOKEN: ${{ github.token }}
5962
run: |
6063
read -r release type < <(gh release list | awk -v release="v$RELEASE_VERSION" '$1 ~ release { print $1,$2; ++n } END { if (n == 0) print "undefined", "undefined" }')
@@ -71,27 +74,31 @@ jobs:
7174
fi
7275
fi
7376
77+
- name: Check if release PR exists
78+
env:
79+
GITHUB_TOKEN: ${{ github.token }}
80+
run: |
7481
release_pr=$(gh pr view rc/$RELEASE_VERSION --json title,state,number)
75-
7682
if [[ ! -z "$release_pr" ]]; then
77-
7883
pr_title=$(echo "$release_pr" | jq -r '.title')
7984
pr_state=$(echo "$release_pr" | jq -r '.state')
8085
pr_number=$(echo "$release_pr" | jq -r '.number')
81-
8286
echo "Found PR '$pr_title' with state '$pr_state'"
83-
8487
if [[ "$pr_title" == "Release v$RELEASE_VERSION" ]] && [[ "$pr_state" != "CLOSED" ]]; then
8588
echo "Release PR is not closed, deleting it to proceed"
8689
gh pr close --delete-branch $pr_number
8790
fi
8891
fi
8992
93+
- name: Delete existing release branch
94+
run: |
9095
if [[ ! -z $(git ls-remote --heads origin rc/$RELEASE_VERSION) ]]; then
9196
echo "Deleting existing release branch"
9297
git push origin --delete rc/$RELEASE_VERSION
9398
fi
9499
100+
- name: Delete existing feature branch
101+
run: |
95102
if [[ ! -z $(git ls-remote --heads origin feature/update-user-manual-for-$RELEASE_VERSION) ]]; then
96103
echo "Deleting existing feature branch"
97104
git push origin --delete feature/update-user-manual-for-$RELEASE_VERSION

0 commit comments

Comments
 (0)