2018-09-13 12:33:13 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# tag-release.sh
|
|
|
|
#
|
2022-08-22 07:43:10 +03:00
|
|
|
# This script is executed before every OSS release.
|
2018-09-13 12:33:13 +03:00
|
|
|
#
|
2022-08-22 07:43:10 +03:00
|
|
|
# Usage: ./tag-release.sh <oss_tag>
|
2018-09-13 12:33:13 +03:00
|
|
|
#
|
2022-08-22 07:43:10 +03:00
|
|
|
# Example: ./tag-release.sh v2.10.0 release/v2.10
|
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-09-12 10:18:10 +03:00
|
|
|
ROOT="$(readlink -f "${BASH_SOURCE[0]%/*}/../" || greadlink -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"
|
2022-08-22 07:43:10 +03:00
|
|
|
RELEASE_BRANCH="$2"
|
2018-09-13 12:33:13 +03:00
|
|
|
|
2022-02-16 11:20:42 +03:00
|
|
|
# check if required argument is set
|
2022-08-22 07:43:10 +03:00
|
|
|
if [[ -z "$OSS_TAG" || -z "$RELEASE_BRANCH" ]]; then
|
|
|
|
echo "Please mention both OSS_TAG and RELEASE_BRANCH"
|
2022-02-16 11:20:42 +03:00
|
|
|
echo ""
|
2022-08-22 07:43:10 +03:00
|
|
|
echo "Usage: ./tag-release.sh <oss_tag> <release_branch>"
|
2022-02-16 11:20:42 +03:00
|
|
|
exit 1
|
2018-09-13 12:33:13 +03:00
|
|
|
fi
|
|
|
|
|
2022-08-22 07:43:10 +03:00
|
|
|
echo "Please make that your $RELEASE_BRANCH is up-to date with hasura/graphql-engine-mono repo."
|
|
|
|
|
2020-02-24 17:33:56 +03:00
|
|
|
# add the latest tag to the catalog_versions file
|
2022-08-22 07:43:10 +03:00
|
|
|
pushd "$ROOT"
|
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-08-22 07:43:10 +03:00
|
|
|
echo "$OSS_TAG $(git show "${RELEASE_BRANCH}:server/src-rsr/catalog_version.txt")" >> "$ROOT/server/src-rsr/catalog_versions.txt"
|
|
|
|
popd
|
2018-09-13 12:33:13 +03:00
|
|
|
|
2022-08-22 07:43:10 +03:00
|
|
|
git add "$ROOT/server/src-rsr"
|
2018-09-13 12:33:13 +03:00
|
|
|
|
2022-08-22 07:43:10 +03:00
|
|
|
git commit -m "ci: tag release $OSS_TAG"
|