Files
grafana-zabbix/.circleci/make-release.sh
Alexander Zobnin 2c1430fd75 CI: sign plugin during release (#1039)
* Add grafana toolkit package

* CI: skip adding binaries to release branch

* CI: test signing plugin

* CI: skip branch build for test releases

* CI: do not use ssh key for fetching

* CI: get plugin in a separate image to avoid git LFS error

* CI: fix attaching workspace

* CI: fix attaching dir

* CI: adjust release process

* CI: clean up
2020-09-02 09:48:54 +03:00

45 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Exit script if you try to use an uninitialized variable.
set -o nounset
# Exit script if a statement returns a non-true return value.
set -o errexit
# Use the error status of the first failure, rather than that of the last item in a pipeline.
set -o pipefail
# Setup git env
git config --global user.email "$CI_GIT_EMAIL"
git config --global user.name "$CI_GIT_USER"
echo "git user is $CI_GIT_USER ($CI_GIT_EMAIL)"
RELEASE_VER=$(echo "$CIRCLE_TAG" | grep -Po "(?<=v)[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)")
if [ -z "$RELEASE_VER" ]; then
echo "No release version provided"
exit 1
fi
if [[ $RELEASE_VER =~ ^[0-9]+(\.[0-9]+){2}(-.+|[^-.]*) ]]; then
echo "Preparing release $RELEASE_VER"
else
echo "Release should has format 1.2.3[-meta], got $RELEASE_VER"
exit 1
fi
RELEASE_BRANCH=release-$RELEASE_VER
# Build plugin
git checkout -b "$RELEASE_BRANCH"
# Skip since moved to publishing plugin assets from github releases
# make clean install dist
# Commit release
# git add --force dist/
# git commit -m "release $RELEASE_VER"
# RELEASE_COMMIT_HASH=$(git log -n 1 | grep -Po "(?<=commit )[0-9a-z]{40}")
# echo "$RELEASE_COMMIT_HASH"
# Push release branch
git push origin "$RELEASE_BRANCH"