Skip to content

Commit 0389923

Browse files
committed
fetch from feat branch
1 parent 5fda4a4 commit 0389923

File tree

2 files changed

+51
-9
lines changed

2 files changed

+51
-9
lines changed

releasing/build-kustomize-library.sh

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
# It builds compressed artifacts on $release_dir.
77
function build_kustomize_binary {
88
echo "build kustomize binaries"
9+
910
version=$1
10-
1111
release_dir=$2
12+
1213
echo "build release artifacts to $release_dir"
1314

1415
mkdir -p "output"
16+
1517
# build date in ISO8601 format
1618
build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
1719
for os in linux darwin windows; do
@@ -61,18 +63,12 @@ main() {
6163
exit 1
6264
fi
6365

64-
release_artifact_dir=$(mktemp -d)
66+
mkdir -p dist
67+
release_artifact_dir=${PWD}/dist
6568

6669
additional_release_artifacts_arg=("$release_artifact_dir"/*)
6770

6871
build_kustomize_binary "${version}" "${release_artifact_dir}"
69-
70-
# create github releases
71-
gh release create "${currentTag}" \
72-
--title "${currentTag}"\
73-
--draft \
74-
--notes-file "${changelog_file}"\
75-
"${additional_release_artifacts_arg[@]}"
7672
}
7773

7874
main $@

releasing/determine-next-version.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
3+
set -eo pipefail
4+
set -o nounset
5+
6+
declare -a RELEASE_TYPES=("major" "minor" "patch")
7+
8+
if [[ -z "${2-}" ]]; then
9+
echo "Release type not specified, using default value: patch"
10+
release_type="patch"
11+
elif [[ ! "${RELEASE_TYPES[*]}" =~ "${2}" ]]; then
12+
echo "Unsupported release type, only input these values: major, minor, patch."
13+
exit 1
14+
fi
15+
16+
function determineNextVersion {
17+
module=$1
18+
currentTag=$(git tag --list "${module}*" --sort=-creatordate | head -n1)
19+
currentVersion=$(echo ${currentTag##*/} | cut -d'v' -f2)
20+
majorVer=$(echo $currentVersion | cut -d'.' -f1)
21+
minorVer=$(echo $currentVersion | cut -d'.' -f2)
22+
patchVer=$(echo $currentVersion | cut -d'.' -f3)
23+
24+
if [[ ${release_type} == "major" ]]; then
25+
majorVer="$(($majorVer + 1))"
26+
elif [[ ${release_type} == "minor" ]]; then
27+
minorVer="$(($minorVer + 1))"
28+
elif [[ ${release_type} == "patch" ]]; then
29+
patchVer="$(($patchVer + 1))"
30+
else
31+
echo "Error: release_type not supported. Available values 'major', 'minor', 'patch'"
32+
exit 1
33+
fi
34+
35+
echo "$majorVer.$minorVer.$patchVer"
36+
}
37+
38+
main() {
39+
module=$1
40+
release_type=$2
41+
nextVersion=$(determineNextVersion $module)
42+
echo "v$nextVersion"
43+
exit 0
44+
}
45+
46+
main "$@"

0 commit comments

Comments
 (0)