Skip to content

Commit 2e265ed

Browse files
committed
ci: Allow to continue release flow for existing version
1 parent 290ed4b commit 2e265ed

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

release.sh

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ function error() {
3535
return 1
3636
}
3737

38+
function skip() {
39+
echo "👌 SKIPPED."
40+
exit 0
41+
}
42+
3843
function get_current_version() {
3944
local version=""
4045
if [[ -f $properties ]]; then
@@ -66,6 +71,12 @@ function replace() {
6671
function diff_link() {
6772
echo -n "$github_repository_url/compare/${1}...${2}"
6873
}
74+
75+
function wait_confirmation() {
76+
local input
77+
read -p " Enter 'yes' to continue: " -r input
78+
[[ $input == "yes" ]]
79+
}
6980
#endregion
7081

7182
# Check if the module exists
@@ -74,8 +85,8 @@ function diff_link() {
7485
# 0. Fetch remote changes
7586
echo "️⏳ Creating release branch..."
7687
release_branch="release/$release"
77-
git checkout --quiet -b "$release_branch"
78-
git pull --quiet --rebase origin main
88+
git checkout --quiet -B "$release_branch"
89+
git pull --quiet --rebase origin main || wait_confirmation || skip
7990
echo "✅ Branch '$release_branch' created"
8091
echo
8192

@@ -84,7 +95,7 @@ last_version=$(get_current_version)
8495
version=${release##*-v} # library-v1.0.0 -> 1.0.0
8596
if [[ "$last_version" == "$version" ]]; then
8697
echo "🤔 Version $version is already set."
87-
exit 0
98+
wait_confirmation || skip
8899
fi
89100
echo "🚀 [$module] Update $last_version$version"
90101
echo
@@ -112,16 +123,12 @@ echo "✅ Updated CHANGELOG.md header"
112123
echo
113124
echo "Do you want to commit the changes and push the release branch and tag?"
114125
echo "The release tag push triggers a release workflow on CI."
115-
read -p " Enter 'yes' to continue: " -r input
116-
if [[ "$input" != "yes" ]]; then
117-
echo "👌 SKIPPED."
118-
exit 0
119-
fi
126+
wait_confirmation || skip
120127

121128
# 5. Push changes, trigger release on CI, and give a link to open PR
122129
echo
123130
echo "⏳ Pushing the changes to the remote repository..."
124-
git add "$readme" "$changelog" "$properties" "$build_script"
131+
git add "$module_path"
125132
git commit --quiet --message "$library: $version"
126133
git tag "$release"
127134
git push --quiet origin HEAD "$release"

0 commit comments

Comments
 (0)