-
Notifications
You must be signed in to change notification settings - Fork 0
/
release_new_version.sh
executable file
·54 lines (45 loc) · 1.43 KB
/
release_new_version.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
# Prompt user to input version number
read -p "Please enter the version number (format: vx.x.x, where x represents a digit): " version
# Validate the version number format
if [[ ! $version =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid version format, the correct format is vx.x.x, where x represents a digit"
exit 1
fi
# Switch to the main branch and pull the latest main branch from remote
git checkout main
if [ $? -ne 0 ]; then
echo "Failed to switch to the main branch"
exit 1
fi
git pull origin main
if [ $? -ne 0 ]; then
echo "Failed to pull the latest main branch from remote"
exit 1
fi
# Create and switch to a new branch
new_branch="branch_$version"
git checkout -b $new_branch
if [ $? -ne 0 ]; then
echo "Failed to create and switch to the new branch"
exit 1
fi
# Create git tag and push to remote
git tag $version
if [ $? -ne 0 ]; then
echo "Failed to create the tag"
exit 1
fi
git push origin $version
if [ $? -ne 0 ]; then
echo "Failed to push the tag to remote"
exit 1
fi
# Set environment variable and run make build
export WASM_PLUGIN_SDK_VERSION=$version
make build
if [ $? -ne 0 ]; then
echo "Failed to execute make build"
exit 1
fi
echo "tag $version has been uploaded to origin successfully, please release a new version in https://github.com/wesql/wescale-wasm-plugin-sdk/releases and update sdk version in https://github.com/wesql/wescale-wasm-plugin-template"