Skip to content

Commit

Permalink
chore: Update release script
Browse files Browse the repository at this point in the history
  • Loading branch information
lyxell committed Jul 8, 2021
1 parent bc28632 commit 3518728
Showing 1 changed file with 36 additions and 20 deletions.
56 changes: 36 additions & 20 deletions scripts/create_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,41 @@ pattern='^v([0-9]+)\.([0-9]+)\.([0-9]+)'

current_version=$(git describe --tags --abbrev=0)

if [[ $current_version =~ $pattern ]]; then
[[ $current_version =~ $pattern ]]

if [[ "$1" = "major" ]]; then
next_version="v$((BASH_REMATCH[1]+1)).${BASH_REMATCH[2]}.${BASH_REMATCH[3]}"
elif [[ "$1" = "minor" ]]; then
next_version="v${BASH_REMATCH[1]}.$((BASH_REMATCH[2]+1)).${BASH_REMATCH[3]}"
git tag $next_version
rm -rf GithubRelease
mkdir GithubRelease
cd GithubRelease
cmake -DCMAKE_BUILD_TYPE=Release ../..
make
# Make sure that the tests pass
make test
# test that binary outputs correct version
[[ "$(./logifix --version)" = "$next_version" ]]
# check linked libraries
ldd ./logifix
read -p "Looks ok? " -n 1 -r
echo # (optional) move to a new line
[[ $REPLY =~ ^[Yy]$ ]]
# create tarball
tarball="logifix-$next_version-x86_64-linux-gnu.tar.gz"
tar -cvzf $tarball logifix
gh release create --title $next_version --draft $next_version $tarball
elif [[ "$1" = "patch" ]]; then
next_version="v${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.$((BASH_REMATCH[3]+1))"
fi

if [[ -z $next_version ]]; then
echo "specify major, minor or patch"
exit 1
fi

echo "Creating version $next_version"

read -p "Looks ok? Answer y/n" -n 1 -r
[[ $REPLY =~ ^[Yy]$ ]]

git tag $next_version
rm -rf GithubRelease
mkdir GithubRelease
cd GithubRelease
cmake -DCMAKE_BUILD_TYPE=Release ../..
make
# Make sure that the tests pass
make test
# test that binary outputs correct version
[[ "$(./logifix --version)" = "$next_version" ]]
# check linked libraries
ldd ./logifix
read -p "Looks ok? Answer y/n" -n 1 -r
[[ $REPLY =~ ^[Yy]$ ]]
# create tarball
tarball="logifix-$next_version-x86_64-linux-gnu.tar.gz"
tar -cvzf $tarball logifix
gh release create --title $next_version --draft $next_version $tarball

0 comments on commit 3518728

Please sign in to comment.