2018-09-13 12:33:13 +03:00
#!/usr/bin/env bash
#
# tag-release.sh
#
# Update installation manifests with the release tag, and execute other release
# hygiene tasks, makes a commit and tags that commit with the given tag.
#
# Usage: ./tag-release.sh <tag> [<optional-tag-message>]
#
# Example: ./tag-release.sh v1.1.0
#
# exit on error
set -e
# get the repo root
ROOT = " $( readlink -f ${ BASH_SOURCE [0]%/* } /../) "
# check if required argument is set
if [ -z " $1 " ] ; then
echo "Usage: ./tag-release.sh <tag> [<optional-tag-message>]"
exit 1
fi
# assign arguments to variables
TAG = $1
MESSAGE = $2
# default message to tag
if [ -z " $MESSAGE " ] ; then
MESSAGE = " $TAG "
fi
# replace the image version with latest tag for all references in install-manifests
2018-11-23 16:29:22 +03:00
find " $ROOT /install-manifests " \
-type f -exec sed -i -E \
's#(hasura/graphql-engine:)v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(.*)*$#\1' " ${ TAG } " '\9#' { } \;
2021-07-29 12:21:02 +03:00
# update version in CLI installation instructions
2021-09-03 09:50:57 +03:00
sed -i -E 's#(.*)v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(.*)*$#\1' " ${ TAG } " '\9#' \
" ${ ROOT } /cli/README.md " \
" ${ ROOT } /docs/graphql/core/hasura-cli/install-hasura-cli.rst " \
# update version in CI image scanning tags
sed -i -E 's#v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)#' " ${ TAG } " '#' \
" ${ ROOT } /.buildkite/pipeline-gen/pipeline/scan_graphql_engine_images.go " \
" ${ ROOT } /.buildkite/pipeline-gen/pipeline/scan_graphql_engine_pro_images.go "
2021-07-29 12:21:02 +03:00
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 "
echo $TAG $( cat " $ROOT /server/src-rsr/catalog_version.txt " ) >> " $ROOT /server/src-rsr/catalog_versions.txt "
2020-02-24 17:33:56 +03:00
2018-11-23 16:29:22 +03:00
git add " $ROOT /install-manifests " \
2021-07-29 12:21:02 +03:00
" $ROOT /server/src-rsr " \
" ${ ROOT } /cli/README.md " \
2021-09-03 09:50:57 +03:00
" ${ ROOT } /docs/graphql/core/hasura-cli/install-hasura-cli.rst " \
" ${ ROOT } /.buildkite/pipeline-gen/pipeline/scan_graphql_engine_images.go " \
" ${ ROOT } /.buildkite/pipeline-gen/pipeline/scan_graphql_engine_pro_images.go "
2018-09-13 12:33:13 +03:00
2020-02-25 09:59:55 +03:00
git commit -m " tag release $TAG "
2018-09-13 12:33:13 +03:00
git tag -a " $TAG " -m " $MESSAGE "
echo " tagged $TAG "