File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Ensure the script exits if any command fails
4
+ set -e
5
+
6
+ # Check if two arguments are passed
7
+ if [ " $# " -ne 1 ]; then
8
+ echo " Usage: $0 <release-branch-name>"
9
+ exit 1
10
+ fi
11
+
12
+ # Assign arguments to variables
13
+ RELEASE_BRANCH=$1
14
+
15
+ # Checkout main branch
16
+ git checkout main
17
+
18
+ # Pull the latest changes
19
+ git pull
20
+
21
+ # Checkout release branch
22
+ git checkout $RELEASE_BRANCH
23
+
24
+ # Merge the main branch
25
+ git merge main --commit --no-edit
26
+
27
+ # Automatically bump the patch version (Y)
28
+ VERSION_FILE=" ansys/api/geometry/VERSION"
29
+ if [ ! -f " $VERSION_FILE " ]; then
30
+ echo " Error: VERSION file not found at $VERSION_FILE "
31
+ exit 1
32
+ fi
33
+
34
+ # Extract current version and bump Y
35
+ CURRENT_VERSION=$( cat " $VERSION_FILE " )
36
+ IFS=' .' read -r MAJOR MINOR PATCH <<< " $CURRENT_VERSION"
37
+ NEW_VERSION=" $MAJOR .$MINOR .$(( PATCH + 1 )) "
38
+
39
+ # Update the VERSION file
40
+ echo " $NEW_VERSION " > " $VERSION_FILE "
41
+
42
+ # Commit the release bump
43
+ git add " $VERSION_FILE "
44
+ git commit -m " release: v$NEW_VERSION "
45
+
46
+ # Push to origin
47
+ git push origin $RELEASE_BRANCH
48
+
49
+ # Tag the release
50
+ git tag " v$NEW_VERSION "
51
+ git push origin " v$NEW_VERSION "
52
+
53
+ # Checkout main again
54
+ git checkout main
You can’t perform that action at this time.
0 commit comments