1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-18 11:11:34 +03:00
vimr/bin/set_new_versions.sh

82 lines
2.3 KiB
Bash
Raw Normal View History

2016-10-14 13:15:32 +03:00
#!/bin/bash
2019-12-22 23:45:42 +03:00
set -Eeuo pipefail
2016-10-14 13:31:51 +03:00
2019-12-22 23:45:42 +03:00
readonly is_snapshot=${is_snapshot:?"true or false"}
2020-11-20 10:19:28 +03:00
marketing_version=${marketing_version:-""}
main() {
if [[ "${is_snapshot}" == false && -z "${marketing_version}" ]]; then
2022-03-12 22:24:21 +03:00
echo "When no snapshot, you have to set 'marketing_version', eg v0.38.1"
2021-12-13 20:47:02 +03:00
if [[ "${marketing_version}" =~ ^v.* ]]; then
echo "### marketing_version must not begin with v!"
exit 1
fi
2020-11-20 10:19:28 +03:00
exit 1
fi
echo "### Setting versions of VimR"
pushd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null
2016-10-14 13:15:32 +03:00
2020-11-20 10:19:28 +03:00
local bundle_version
bundle_version="$(date "+%Y%m%d.%H%M%S")"
readonly bundle_version
2016-10-15 00:55:38 +03:00
2020-11-20 10:19:28 +03:00
if [[ "${is_snapshot}" == true ]]; then
2019-12-22 23:45:42 +03:00
marketing_version="SNAPSHOT-${bundle_version}"
fi
2016-10-14 13:15:32 +03:00
2020-11-20 10:19:28 +03:00
pushd VimR >/dev/null
agvtool new-version -all "${bundle_version}"
agvtool new-marketing-version "${marketing_version}"
popd >/dev/null
2017-12-03 11:59:15 +03:00
2020-11-20 10:19:28 +03:00
popd >/dev/null
echo "### Set versions of VimR"
2021-12-13 20:47:02 +03:00
local tag
2022-03-24 20:08:11 +03:00
local github_release_name
local version_marker
2021-12-13 20:47:02 +03:00
if [[ "${is_snapshot}" == true ]]; then
2022-03-12 22:24:21 +03:00
tag="snapshot/${bundle_version}"
2022-03-24 20:08:11 +03:00
github_release_name="${marketing_version}"
version_marker="snapshot"
2021-12-13 20:47:02 +03:00
else
2022-03-12 22:24:21 +03:00
tag="v${marketing_version}-${bundle_version}"
2022-03-24 20:08:11 +03:00
github_release_name="$tag"
version_marker="release"
2022-04-16 19:44:30 +03:00
marketing_version="v${marketing_version}"
2021-12-13 20:47:02 +03:00
fi
2022-03-24 20:08:11 +03:00
readonly tag
readonly github_release_name
readonly version_marker
2022-04-16 19:44:30 +03:00
readonly marketing_version
2022-03-24 20:08:11 +03:00
local output
output=$(cat <<-END
declare -r -x is_snapshot=${is_snapshot}
declare -r -x bundle_version=${bundle_version}
declare -r -x marketing_version=${marketing_version}
declare -r -x tag=${tag}
declare -r -x github_release_name=${github_release_name}
declare -r -x release_notes=\$(cat release-notes.temp.md)
# Add release notes to release-notes.temp.md and issue
# create_gh_release=true upload=true update_appcast=true release_spec_file=${bundle_version}-${version_marker}.sh ./bin/build_release.sh
2022-03-24 20:08:11 +03:00
END
)
readonly output
echo "Release notes" > release-notes.temp.md
2022-03-24 20:08:11 +03:00
echo "${output}" > "${bundle_version}-${version_marker}.sh"
echo "### Tag, commit and push with ${tag}"
echo "### Use the following to build a release:"
echo "release_spec_file=${bundle_version}-${version_marker}.sh \\"
echo "create_gh_release=true upload=true update_appcast=true \\"
echo "./bin/build_release.sh"
2020-11-20 10:19:28 +03:00
}
2017-12-03 11:59:15 +03:00
2020-11-20 10:19:28 +03:00
main