-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrelease
More file actions
executable file
·29 lines (24 loc) · 794 Bytes
/
release
File metadata and controls
executable file
·29 lines (24 loc) · 794 Bytes
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
#!/bin/bash
# Increment version in manifest.json based on argument
current_version=$(grep -o '"version": "[0-9]\+\.[0-9]\+\.[0-9]\+"' manifest.json | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
IFS='.' read -r major minor patch <<< "$current_version"
if [[ $1 == "major" ]]; then
major=$((major + 1))
minor=0
patch=0
elif [[ $1 == "minor" ]]; then
minor=$((minor + 1))
patch=0
elif [[ $1 == "patch" ]]; then
patch=$((patch + 1))
else
echo "Invalid argument. Use 'major', 'minor', or 'patch'."
exit 1
fi
new_version="$major.$minor.$patch"
# Update the version in manifest.json
sed -i '' -e "s/\"version\": \"$current_version\"/\"version\": \"$new_version\"/" manifest.json
# Commit and tag
git add manifest.json
git commit -m "Bump version to $new_version"
git tag "v$new_version"