Skip to content

Commit f63e919

Browse files
committed
revert untouched file
1 parent 3d840a6 commit f63e919

File tree

1 file changed

+1
-54
lines changed

1 file changed

+1
-54
lines changed

releasing/create-release.sh

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,14 @@ set -o errexit
2323
set -o nounset
2424
set -o pipefail
2525

26-
declare -a RELEASE_TYPES=("major" "minor" "patch")
27-
upstream_master="master"
28-
origin_master="master"
29-
3026
if [[ -z "${1-}" ]]; then
3127
echo "Usage: $0 TAG"
3228
echo " TAG: the tag to build or release, e.g. api/v1.2.3"
3329
exit 1
3430
fi
3531

36-
if [[ -z "${2-}" ]]; then
37-
echo "Release type not specified, using default value: patch"
38-
release_type="patch"
39-
elif [[ ! "${RELEASE_TYPES[*]}" =~ "${2}" ]]; then
40-
echo "Unsupported release type, only input these values: major, minor, patch."
41-
exit 1
42-
fi
43-
4432
git_tag=$1
45-
release_type=$2
46-
4733
echo "release tag: $git_tag"
48-
echo "release type: $release_type"
4934

5035
# Build the release binaries for every OS/arch combination.
5136
# It builds compressed artifacts on $release_dir.
@@ -96,39 +81,22 @@ function build_kustomize_binary {
9681
}
9782

9883
function create_release {
99-
source ./releasing/helpers.sh
100-
10184
git_tag=$1
10285

10386
# Take everything before the last slash.
10487
# This is expected to match $module.
10588
module=${git_tag%/*}
106-
module_slugified=$(echo $module | iconv -t ascii//TRANSLIT | sed -E -e 's/[^[:alnum:]]+/-/g' -e 's/^-+|-+$//g' | tr '[:upper:]' '[:lower:]')
10789

10890
# Take everything after the last slash.
10991
version=${git_tag##*/}
11092

111-
determineNextVersion $@
112-
113-
release_branch="release-${module}/${nextVersion}"
114-
115-
# Create release branch release-{module}/{version}
116-
echo "Creating release branch $release_branch..."
117-
git fetch --tags upstream $upstream_master
118-
git branch $release_branch $origin_master
119-
git commit -a -m "create release branch $release_branch" || true
120-
git push -f origin $release_branch
121-
12293
# Generate the changelog for this release
12394
# using the last two tags for the module
12495
changelog_file=$(mktemp)
125-
./releasing/compile-changelog.sh "$module" "HEAD" "$changelog_file"
96+
./releasing/compile-changelog.sh "$module" "$git_tag" "$changelog_file"
12697

12798
additional_release_artifacts_arg=""
12899

129-
# Trigger workflow for respective modeule release
130-
gh workflow run "release-${module_slugified}.yml" -f "release_type=${release_type}" -f "release_branch=${release_branch}"
131-
132100
# build `kustomize` binary
133101
if [[ "$module" == "kustomize" ]]; then
134102
release_artifact_dir=$(mktemp -d)
@@ -154,27 +122,6 @@ function create_release {
154122
--notes-file "$changelog_file"
155123
}
156124

157-
function determineNextVersion {
158-
currentTag=$(git tag --list "${module}*" --sort=-creatordate | head -n1)
159-
currentVersion=$(echo ${currentTag##*/} | cut -d'v' -f2)
160-
majorVer=$(echo $currentVersion | cut -d'.' -f1)
161-
minorVer=$(echo $currentVersion | cut -d'.' -f2)
162-
patchVer=$(echo $currentVersion | cut -d'.' -f3)
163-
164-
if [[ ${release_type} == "major" ]]; then
165-
majorVer="$(($majorVer + 1))"
166-
elif [[ ${release_type} == "minor" ]]; then
167-
minorVer="$(($minorVer + 1))"
168-
elif [[ ${release_type} == "patch" ]]; then
169-
patchVer="$(($patchVer + 1))"
170-
else
171-
echo "Error: release_type not supported. Available values 'major', 'minor', 'patch'"
172-
exit 1
173-
fi
174-
175-
nextVersion="$majorVer.$minorVer.$patchVer"
176-
return
177-
}
178125

179126
## create release
180127
create_release "$git_tag"

0 commit comments

Comments
 (0)