Skip to content

Commit

Permalink
stop release if unit test fails
Browse files Browse the repository at this point in the history
  • Loading branch information
sokil committed Dec 12, 2020
1 parent bc0ac6f commit ea75036
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions bin/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,21 @@ echo -e "\033[0;32mTest updated database\033[0m"
$COMPOSER_PATH test

# message on success test
if [[ $? -eq 0 ]]; then
# get new version of library
cd $PKG_ISOCODES_DIR
VERSION=`git describe --tags`
BUILD_DATE=`date "+%Y-%m-%d %H:%M"`
cd $PROJECT_DIR

# update version in README.md
sed -i -E "s/Database version: .*/Database version: ${VERSION} from ${BUILD_DATE}/" README.md

# success message
echo -e "\033[0;32m\n\nDatabase successfully updated. Now you can verify difference, commit and add new release.\033[0m"
echo -e "\033[0;32mDatabase version: ${VERSION} from ${BUILD_DATE}.\033[0m\n\n"
if [[ $? -ne 0 ]]; then
echo "Unit tests failed. Release process stopped. Please, check test errors"
exit 1
fi

# get new version of library
cd $PKG_ISOCODES_DIR
VERSION=`git describe --tags`
BUILD_DATE=`date "+%Y-%m-%d %H:%M"`
cd $PROJECT_DIR

# update version in README.md
sed -i -E "s/Database version: .*/Database version: ${VERSION} from ${BUILD_DATE}/" README.md

# success message
echo -e "\033[0;32m\n\nDatabase successfully updated. Now you can verify difference, commit and add new release.\033[0m"
echo -e "\033[0;32mDatabase version: ${VERSION} from ${BUILD_DATE}.\033[0m\n\n"

0 comments on commit ea75036

Please sign in to comment.