-
Notifications
You must be signed in to change notification settings - Fork 1k
/
release.sh
33 lines (32 loc) · 727 Bytes
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# Get new tags from remote
git fetch --tags
# Get latest tag name
latestTag=$(git describe --tags `git rev-list --tags --max-count=1`)
# Parse v1.2.3 into array
latestTag=${latestTag//./ }
latestTag=${latestTag/v/}
version=($latestTag)
# Calculate new version
case $1 in
major)
version[0]=$((version[0]+1))
version[1]=0
version[2]=0
;;
minor)
version[1]=$((version[1]+1))
version[2]=0
;;
*) # build
version[2]=$((version[2]+1))
;;
esac
# Constuct new tag
newTag=v${version[0]}.${version[1]}.${version[2]}
# Build all files
php update.php
php build.php
git commit -am "update dependencies" && git push
# Build all files
gh release create $newTag api.php api.include.php