2018-09-13 12:33:13 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# tag-release.sh
|
|
|
|
#
|
2022-02-16 11:20:42 +03:00
|
|
|
# This script is executed before every OSS and Pro releases.
|
2018-09-13 12:33:13 +03:00
|
|
|
#
|
2022-02-16 11:20:42 +03:00
|
|
|
# Usage: ./tag-release.sh <oss_tag> <pro_tag>
|
2018-09-13 12:33:13 +03:00
|
|
|
#
|
2022-02-16 11:20:42 +03:00
|
|
|
# Example: ./tag-release.sh v1.1.0 v1.1.0-pro.1
|
2018-09-13 12:33:13 +03:00
|
|
|
#
|
|
|
|
|
|
|
|
# exit on error
|
2022-02-16 11:20:42 +03:00
|
|
|
set -eo pipefail
|
2018-09-13 12:33:13 +03:00
|
|
|
|
|
|
|
# get the repo root
|
2022-02-16 11:20:42 +03:00
|
|
|
ROOT="$(readlink -f "${BASH_SOURCE[0]%/*}/../")"
|
2018-09-13 12:33:13 +03:00
|
|
|
|
|
|
|
# assign arguments to variables
|
2022-02-16 11:20:42 +03:00
|
|
|
OSS_TAG="$1"
|
|
|
|
PRO_TAG="$2"
|
2018-09-13 12:33:13 +03:00
|
|
|
|
2022-02-16 11:20:42 +03:00
|
|
|
# check if required argument is set
|
|
|
|
if [[ -z "$OSS_TAG" || -z "$PRO_TAG" ]]; then
|
|
|
|
echo "Please mention both OSS_TAG and PRO_TAG"
|
|
|
|
echo ""
|
|
|
|
echo "Usage: ./tag-release.sh <oss_tag> <pro_tag>"
|
|
|
|
exit 1
|
2018-09-13 12:33:13 +03:00
|
|
|
fi
|
|
|
|
|
2020-02-24 17:33:56 +03:00
|
|
|
# add the latest tag to the catalog_versions file
|
2020-02-25 09:59:55 +03:00
|
|
|
[ -n "$(tail -c1 "$ROOT/server/src-rsr/catalog_versions.txt")" ] && echo >> "$ROOT/server/src-rsr/catalog_versions.txt"
|
2022-02-16 11:20:42 +03:00
|
|
|
echo "$OSS_TAG $(cat "$ROOT/server/src-rsr/catalog_version.txt")" >> "$ROOT/server/src-rsr/catalog_versions.txt"
|
|
|
|
|
|
|
|
# update OSS changelog
|
|
|
|
OSS_VERSION_ENTRY="## Next release\n\n### Bug fixes and improvements\n\n## $OSS_TAG"
|
|
|
|
sed -i "s/## Next release/${OSS_VERSION_ENTRY}/" "$ROOT/CHANGELOG.md"
|
|
|
|
|
|
|
|
# update Pro changelog
|
|
|
|
PRO_NEXT_RELEASE_TEXT="## Next release\n(Add entries below in the order of multitenant, server, console, cli, docs, others)"
|
|
|
|
sed -i "N;s/${PRO_NEXT_RELEASE_TEXT}/${PRO_NEXT_RELEASE_TEXT}\n\n## ${PRO_TAG}/" "$ROOT/pro/CHANGELOG.md"
|
2020-02-24 17:33:56 +03:00
|
|
|
|
2022-02-16 11:20:42 +03:00
|
|
|
git add "$ROOT/server/src-rsr" \
|
|
|
|
"$ROOT/CHANGELOG.md" \
|
|
|
|
"$ROOT/pro/CHANGELOG.md"
|
2018-09-13 12:33:13 +03:00
|
|
|
|
2022-02-16 11:20:42 +03:00
|
|
|
git commit -m "ci: tag release $OSS_TAG and $PRO_TAG"
|
2018-09-13 12:33:13 +03:00
|
|
|
|
2022-02-16 11:20:42 +03:00
|
|
|
git tag -a "$OSS_TAG" -m "tag release $OSS_TAG"
|
|
|
|
git tag -a "$PRO_TAG" -m "tag release $PRO_TAG"
|
2018-09-13 12:33:13 +03:00
|
|
|
|
2022-02-16 11:20:42 +03:00
|
|
|
echo "tagged $OSS_TAG and $PRO_TAG"
|