Skip to content

Commit dd0b401

Browse files
Merge branch 'main' into release/0.4
2 parents 4c4aa24 + 5e6aac6 commit dd0b401

File tree

5 files changed

+105
-55
lines changed

5 files changed

+105
-55
lines changed

.github/workflows/autorelease.yml

Lines changed: 6 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -32,56 +32,18 @@ jobs:
3232
git config --global user.name ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
3333
git config --global user.email ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
3434
35-
# Retrieve the latest release tag from GitHub
36-
- name: Get Latest Release Branch
37-
id: get-release
38-
run: |
39-
# Fetch all tags
40-
git fetch --tags
41-
42-
# Get the latest release tag
43-
LATEST_RELEASE=$(git tag --list "v*" --sort=-version:refname | head -n 1)
44-
45-
# Parse major and minor version numbers
46-
if [[ "$LATEST_RELEASE" =~ ^v([0-9]+)\.([0-9]+)\.[0-9]+$ ]]; then
47-
MAJOR="${BASH_REMATCH[1]}"
48-
MINOR="${BASH_REMATCH[2]}"
49-
RELEASE_BRANCH="release/${MAJOR}.${MINOR}"
50-
echo "Latest release tag: $LATEST_RELEASE"
51-
echo "Associated release branch: $RELEASE_BRANCH"
52-
else
53-
echo "Error: Unable to parse the latest release tag."
54-
exit 1
55-
fi
56-
57-
# Export the release branch name
58-
echo "RELEASE_BRANCH=${RELEASE_BRANCH}" >> $GITHUB_ENV
59-
6035
# Run the patch release script
6136
- name: Run Patch Release Script
62-
if: ${{ github.event.inputs.release_type == 'patch' }}
63-
env:
64-
GITHUB_TOKEN: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
65-
RELEASE_BRANCH: ${{ env.RELEASE_BRANCH }}
66-
run: |
67-
./scripts/patch_release.sh ${{ env.RELEASE_BRANCH }}
68-
69-
# Run the minor release script
70-
- name: Run Minor Release Script
71-
if: ${{ github.event.inputs.release_type == 'minor' }}
37+
if: ${{ inputs.release_type == 'patch' }}
7238
env:
7339
GITHUB_TOKEN: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
7440
run: |
75-
# TODO: Implement the minor release script
76-
echo "Minor release script not implemented."
77-
exit 1
41+
./scripts/patch_release.sh
7842
79-
# Run the major release script
80-
- name: Run Major Release Script
81-
if: ${{ github.event.inputs.release_type == 'major' }}
43+
# Run the major/minor release script
44+
- name: Run Major/Minor Release Script
45+
if: ${{ inputs.release_type == 'major' || inputs.release_type == 'minor' }}
8246
env:
8347
GITHUB_TOKEN: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
8448
run: |
85-
# TODO: Implement the major release script
86-
echo "Major release script not implemented."
87-
exit 1
49+
./scripts/major_minor_release.sh ${{ inputs.release_type }}

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ requires = [
33
"setuptools >= 42.0.0",
44
"wheel",
55
"ansys_tools_protoc_helper>=0.4.0",
6-
"ansys-api-dbu==0.3.7",
6+
"ansys-api-dbu==0.3.8",
77
]
88
build-backend = "setuptools.build_meta:__legacy__"

scripts/major_minor_release.sh

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/bin/bash
2+
3+
# Ensure the script exits if any command fails
4+
set -e
5+
6+
# Check if one argument is passed
7+
if [ "$#" -ne 1 ]; then
8+
echo "Usage: $0 <bump-type>"
9+
echo "<bump-type>: 'minor' or 'major'"
10+
exit 1
11+
fi
12+
13+
# Assign the argument to a variable
14+
BUMP_TYPE=$1
15+
16+
if [[ "$BUMP_TYPE" != "minor" && "$BUMP_TYPE" != "major" ]]; then
17+
echo "Error: Bump type must be 'minor' or 'major'."
18+
exit 1
19+
fi
20+
21+
# Checkout main branch
22+
git checkout main
23+
24+
# Pull the latest changes
25+
git pull
26+
27+
# File containing the version
28+
VERSION_FILE="ansys/api/geometry/VERSION"
29+
30+
if [ ! -f "$VERSION_FILE" ]; then
31+
echo "Error: VERSION file not found at $VERSION_FILE"
32+
exit 1
33+
fi
34+
35+
# Extract the current version
36+
CURRENT_DEV_VERSION=$(cat "$VERSION_FILE")
37+
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_DEV_VERSION"
38+
39+
# Calculate new version for release and development
40+
if [ "$BUMP_TYPE" == "major" ]; then
41+
# VERSION file on main: 0.2.dev0
42+
# New release VERSION file: 1.0.0
43+
# New dev VERSION file: 1.1.dev0
44+
NEW_RELEASE_VERSION="$((MAJOR + 1)).0.0"
45+
NEW_DEV_VERSION="$((MAJOR + 1)).1.dev0"
46+
NEW_RELEASE_BRANCH="release/$((MAJOR + 1)).0"
47+
elif [ "$BUMP_TYPE" == "minor" ]; then
48+
# VERSION file on main: 0.2.dev0
49+
# New release VERSION file: 0.2.0
50+
# New dev VERSION file: 0.3.dev0
51+
NEW_RELEASE_VERSION="$MAJOR.$MINOR.0"
52+
NEW_DEV_VERSION="$MAJOR.$((MINOR + 1)).dev0"
53+
NEW_RELEASE_BRANCH="release/$MAJOR.$MINOR"
54+
fi
55+
56+
# Create the release branch and bump the release version
57+
git checkout -b "$NEW_RELEASE_BRANCH"
58+
echo "$NEW_RELEASE_VERSION" > "$VERSION_FILE"
59+
git add "$VERSION_FILE"
60+
git commit -m "release: v$NEW_RELEASE_VERSION"
61+
62+
# Push the release branch
63+
git push origin "$NEW_RELEASE_BRANCH"
64+
65+
# Tag the release
66+
git tag "v$NEW_RELEASE_VERSION"
67+
git push origin "v$NEW_RELEASE_VERSION"
68+
69+
# Return to main and bump the dev version
70+
git checkout main
71+
echo "$NEW_DEV_VERSION" > "$VERSION_FILE"
72+
git add "$VERSION_FILE"
73+
git commit -m "chore: bump dev version to $NEW_DEV_VERSION"
74+
75+
# Push the changes to main
76+
git push origin main
77+
78+
echo "Release branch '$NEW_RELEASE_BRANCH' created with version $NEW_RELEASE_VERSION."
79+
echo "Main branch bumped to development version $NEW_DEV_VERSION."

scripts/patch_release.sh

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,30 @@
33
# Ensure the script exits if any command fails
44
set -e
55

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-
156
# Checkout main branch
167
git checkout main
178

189
# Pull the latest changes
1910
git pull
2011

12+
# Fetch all tags
13+
git fetch --tags
14+
15+
# Get the latest release tag
16+
LATEST_RELEASE=$(git tag --list "v*" --sort=-version:refname | head -n 1)
17+
18+
# Parse major and minor version numbers
19+
if [[ "$LATEST_RELEASE" =~ ^v([0-9]+)\.([0-9]+)\.[0-9]+$ ]]; then
20+
MAJOR="${BASH_REMATCH[1]}"
21+
MINOR="${BASH_REMATCH[2]}"
22+
RELEASE_BRANCH="release/${MAJOR}.${MINOR}"
23+
echo "Latest release tag: $LATEST_RELEASE"
24+
echo "Associated release branch: $RELEASE_BRANCH"
25+
else
26+
echo "Error: Unable to parse the latest release tag."
27+
exit 1
28+
fi
29+
2130
# Checkout release branch
2231
git checkout $RELEASE_BRANCH
2332

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
url=f"https://github.com/ansys/{package_name}",
4040
license="MIT",
4141
python_requires=">=3.10",
42-
install_requires=["grpcio~=1.44", "protobuf>=3.19,<6", "ansys-api-dbu==0.3.7"],
42+
install_requires=["grpcio~=1.44", "protobuf>=3.19,<6", "ansys-api-dbu==0.3.8"],
4343
packages=setuptools.find_namespace_packages(".", include=("ansys.*",)),
4444
package_data={
4545
"": ["*.proto", "*.pyi", "py.typed", "VERSION"],

0 commit comments

Comments
 (0)