Skip to content

Commit

Permalink
feat(#6): release versioning script
Browse files Browse the repository at this point in the history
  • Loading branch information
jannis-baum committed Jul 25, 2023
1 parent 1fda2ab commit ddd042e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "vivify-server",
"version": "0.0.1",
"repository": "https://github.com/jannis-baum/vivify.git",
"author": "Jannis Baum",
"scripts": {
Expand Down
22 changes: 22 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

if [ "$1" != "minor" -a "$1" != "major" ]; then
echo "Specify increment minor|major."
exit 1
fi

version="v0.0.0"
prev=$(git tag --sort=version:refname | tail -1)

if [ -n "$prev" ]; then
prefix=$(cut -d. -f1 <<< $prev)
major=$(cut -d. -f2 <<< $prev)

[ "$1" = "minor" ] && minor=$(bc <<< "$(cut -d. -f3 <<< $prev) + 1")
[ "$1" = "major" ] && major=$(bc <<< "$major + 1") && minor="0"

version="$prefix.$major.$minor"
fi

git tag -s -a $version
git push origin $version

0 comments on commit ddd042e

Please sign in to comment.