Skip to content

Commit bea390d

Browse files
Merge branch 'main' into release/1.0
2 parents 47f052b + 2c1f3ee commit bea390d

File tree

6 files changed

+141
-2
lines changed

6 files changed

+141
-2
lines changed

.github/workflows/autoupgrade.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Auto upgrade dependencies
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
release:
8+
name: Auto upgrade dependencies
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
# Checkout the repository
13+
- name: Checkout Repository
14+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
15+
with:
16+
fetch-depth: 0
17+
fetch-tags: true
18+
show-progress: true
19+
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
20+
21+
# Configure Git
22+
- name: Configure Git
23+
run: |
24+
git config --global user.name ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
25+
git config --global user.email ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
26+
27+
# Run the upgrade script
28+
- name: Run Upgrade Script
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
31+
run: |
32+
./scripts/upgrade_deps.sh ansys-api-geometry

ansys/api/discovery/v1/design/designdoc.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ message GetAssemblyResponse {
4949
map <string, CoordinateSystemList> component_coord_systems=7;
5050
map <string, int32> component_shared_topologies=8;
5151
repeated ansys.api.discovery.v1.design.BeamEntity beams=9;
52+
repeated ansys.api.discovery.v1.design.CurveEntity design_points=10;
5253
}
5354

5455
message CoordinateSystemList {

ansys/api/discovery/v1/design/selections/namedselection.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ service NamedSelection{
1818

1919
rpc GetAll(ParentEntityRequest) returns(GetAllResponse);
2020

21+
rpc SetName(SetDesignEntityNameRequest) returns (SetDesignEntityNameResponse);
22+
2123
//TODO: Enable named selection contents to be defined.
2224
}
2325

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-geometry==0.4.87"
6+
"ansys-api-geometry==0.4.88"
77
]
88
build-backend = "setuptools.build_meta:__legacy__"

scripts/upgrade_deps.sh

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
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 <package-name>"
9+
echo "Example: $0 ansys-api-geometry"
10+
exit 1
11+
fi
12+
13+
# Assign the argument to a variable
14+
PACKAGE_NAME=$1
15+
16+
echo "Upgrading $PACKAGE_NAME to latest version..."
17+
18+
# Check if curl and jq are available
19+
if ! command -v curl &> /dev/null; then
20+
echo "Error: curl is required but not installed"
21+
exit 1
22+
fi
23+
24+
if ! command -v jq &> /dev/null; then
25+
echo "Error: jq is required but not installed"
26+
exit 1
27+
fi
28+
29+
# Check if the package exists on PyPI and get latest version
30+
echo "Fetching latest version from PyPI..."
31+
LATEST_VERSION=$(curl -s "https://pypi.org/pypi/$PACKAGE_NAME/json" | jq -r '.info.version')
32+
33+
if [ $? -ne 0 ]; then
34+
echo "Error: Failed to fetch package info from PyPI"
35+
exit 1
36+
fi
37+
38+
if [ "$LATEST_VERSION" == "null" ] || [ -z "$LATEST_VERSION" ]; then
39+
echo "Error: Could not find version for package $PACKAGE_NAME"
40+
echo "Please check that the package name is correct and exists on PyPI"
41+
exit 1
42+
fi
43+
44+
echo "Latest version found: $LATEST_VERSION"
45+
46+
# Files to update - with respect to this script file location
47+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
48+
PYPROJECT_FILE="$SCRIPT_DIR/../pyproject.toml"
49+
SETUP_FILE="$SCRIPT_DIR/../setup.py"
50+
51+
# Update pyproject.toml
52+
echo "Updating $PYPROJECT_FILE..."
53+
# Use sed to replace the package version in pyproject.toml
54+
# This handles both == and >= patterns
55+
sed -i.tmp "s/\"$PACKAGE_NAME[=<>!]*[0-9.]*\"/\"$PACKAGE_NAME==$LATEST_VERSION\"/g" "$PYPROJECT_FILE"
56+
rm -f "$PYPROJECT_FILE.tmp"
57+
58+
# Update setup.py
59+
echo "Updating $SETUP_FILE..."
60+
# Use sed to replace the package version in setup.py
61+
# This handles both == and >= patterns in the install_requires list
62+
sed -i.tmp "s/\"$PACKAGE_NAME[=<>!]*[0-9.]*\"/\"$PACKAGE_NAME==$LATEST_VERSION\"/g" "$SETUP_FILE"
63+
rm -f "$SETUP_FILE.tmp"
64+
65+
# Verify changes
66+
echo ""
67+
echo "Changes made:"
68+
echo "============="
69+
70+
echo ""
71+
echo "In $PYPROJECT_FILE:"
72+
grep "$PACKAGE_NAME" "$PYPROJECT_FILE" || echo "Package not found in $PYPROJECT_FILE"
73+
74+
echo ""
75+
echo "In $SETUP_FILE:"
76+
grep "$PACKAGE_NAME" "$SETUP_FILE" || echo "Package not found in $SETUP_FILE"
77+
78+
echo ""
79+
echo "Upgrade completed successfully!"
80+
echo "Package $PACKAGE_NAME has been updated to version $LATEST_VERSION"
81+
82+
# Submit a pull request with the changes - create a branch, commit, push, and open PR
83+
# Only if there are changes to commit
84+
if git diff --quiet "$PYPROJECT_FILE" "$SETUP_FILE"; then
85+
echo "No changes detected in $PYPROJECT_FILE or $SETUP_FILE. Exiting without creating a PR."
86+
exit 0
87+
else
88+
echo "Changes detected. Proceeding to create a pull request."
89+
fi
90+
91+
BRANCH_NAME="upgrade/$PACKAGE_NAME-to-$LATEST_VERSION"
92+
git checkout -b "$BRANCH_NAME"
93+
git add "$PYPROJECT_FILE" "$SETUP_FILE"
94+
git commit -m "build: upgrade $PACKAGE_NAME to $LATEST_VERSION"
95+
git push origin "$BRANCH_NAME"
96+
97+
# Create the pull request
98+
gh pr create --title "build: upgrade $PACKAGE_NAME to $LATEST_VERSION" --body "This PR upgrades $PACKAGE_NAME to version $LATEST_VERSION." --head "$BRANCH_NAME" --base main
99+
if [ $? -ne 0 ]; then
100+
echo "Error: Failed to create pull request"
101+
exit 1
102+
else
103+
echo "Pull request created successfully."
104+
fi

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
url=f"https://github.com/ansys/{package_name}",
3838
license="MIT",
3939
python_requires=">=3.10",
40-
install_requires=["grpcio~=1.44", "protobuf>=3.19,<7", "ansys-api-geometry==0.4.87"],
40+
install_requires=["grpcio~=1.44", "protobuf>=3.19,<7", "ansys-api-geometry==0.4.88"],
4141
packages=setuptools.find_namespace_packages(".", include=("ansys.*",)),
4242
package_data={
4343
"": ["*.proto", "*.pyi", "py.typed", "VERSION"],

0 commit comments

Comments
 (0)