Skip to content

Commit d05c0ae

Browse files
committed
chore: add patch release script
1 parent bac0c24 commit d05c0ae

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

scripts/patch_release.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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

0 commit comments

Comments
 (0)