hyperf/bin/release.sh

51 lines
892 B
Bash
Raw Normal View History

2019-06-20 09:49:50 +08:00
#!/usr/bin/env bash
set -e
if (( "$#" != 1 ))
then
echo "Tag has to be provided"
exit 1
fi
2019-06-23 21:32:13 +08:00
NOW=$(date +%s)
2019-08-16 09:56:51 +08:00
CURRENT_BRANCH="master"
2019-06-20 09:49:50 +08:00
VERSION=$1
BASEPATH=$(cd `dirname $0`; cd ../src/; pwd)
# Always prepend with "v"
if [[ $VERSION != v* ]]
then
VERSION="v$VERSION"
fi
repos=$(ls $BASEPATH)
for REMOTE in $repos
do
echo ""
echo ""
2019-06-23 21:32:13 +08:00
echo "Cloning $REMOTE";
2019-06-20 09:49:50 +08:00
TMP_DIR="/tmp/hyperf-split"
REMOTE_URL="git@github.com:hyperf/$REMOTE.git"
2019-06-20 09:49:50 +08:00
rm -rf $TMP_DIR;
mkdir $TMP_DIR;
(
cd $TMP_DIR;
git clone $REMOTE_URL .
git checkout "$CURRENT_BRANCH";
2019-06-23 21:32:13 +08:00
if [[ $(git log --pretty="%d" -n 1 | grep tag --count) -eq 0 ]]; then
echo "Releasing $REMOTE"
git tag $VERSION
git push origin --tags
fi
2019-06-20 09:49:50 +08:00
)
2019-06-23 21:32:13 +08:00
done
TIME=$(echo "$(date +%s) - $NOW" | bc)
printf "Execution time: %f seconds" $TIME