Skip to content

Commit 48b76f3

Browse files
committed
add release.sh, see #948
1 parent 92aee98 commit 48b76f3

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

release.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
# Get new tags from remote
4+
git fetch --tags
5+
# Get latest tag name
6+
latestTag=$(git describe --tags `git rev-list --tags --max-count=1`)
7+
# Parse v1.2.3 into array
8+
latestTag=${latestTag//./ }
9+
latestTag=${latestTag/v/}
10+
version=($latestTag)
11+
# Calculate new version
12+
case $1 in
13+
major)
14+
version[0]=$((version[0]+1))
15+
version[1]=0
16+
version[2]=0
17+
;;
18+
minor)
19+
version[1]=$((version[1]+1))
20+
version[2]=0
21+
;;
22+
*) # build
23+
version[2]=$((version[2]+1))
24+
;;
25+
esac
26+
# Constuct new tag
27+
newTag=v${version[0]}.${version[1]}.${version[2]}
28+
# Build all files
29+
php install.php
30+
php build.php
31+
# Build all files
32+
gh release create $newTag api.php api.include.php

0 commit comments

Comments
 (0)