forked from dawidd6/action-get-tag
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·37 lines (27 loc) · 855 Bytes
/
build.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
34
35
36
#!/bin/bash
version=0.0.0
update() {
local manifest="package.json"
version=$(jq -r '.version' "$manifest") # Extract current version from package.json
IFS='.' read -r major minor patch <<< "${version#v}" # Split version into components
if ((patch < 9)); then
((patch++))
elif ((minor < 9)); then
((minor++))
patch=0
else
((major++))
minor=0
patch=0
fi
version="v$major.$minor.$patch" # Construct new version string
echo "Updating to version $version"
jq ".version = \"$version\"" "$manifest" > temp.json && mv temp.json "$manifest" # Update version in package.json
}
update
git add .
git commit -am "Update to version: $version"
git tag $version -m "Update to version: $version"
git push origin $version
git push
gh release create $version --generate-notes