File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed
Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -31,14 +31,29 @@ jobs:
3131 - name : Get version from pyproject.toml
3232 id : get_version
3333 run : |
34- CURRENT_VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['tool']['poetry']['version'])")
34+ # First verify the file exists and extract version with error handling
35+ CURRENT_VERSION=$(python -c '
36+ import toml
37+ import sys
38+ try:
39+ config = toml.load("pyproject.toml")
40+ if "project" not in config:
41+ print("Error: Missing [project] section in pyproject.toml", file=sys.stderr)
42+ sys.exit(1)
43+ print(config["project"]["version"])
44+ except Exception as e:
45+ print(f"Error: {str(e)}", file=sys.stderr)
46+ sys.exit(1)
47+ ')
48+
49+ # Store the version in GitHub Actions output
3550 echo "current_version=${CURRENT_VERSION}" >> $GITHUB_OUTPUT
3651
37- # Split version into parts
52+ # Split version into major, minor, patch components
3853 IFS='.' read -r major minor patch <<< "$CURRENT_VERSION"
3954 echo "major_version=${major}" >> $GITHUB_OUTPUT
4055 echo "minor_version=${minor}" >> $GITHUB_OUTPUT
41-
56+
4257 - name : Update version
4358 run : |
4459 set -e # Exit immediately if a command exits with a non-zero status
You can’t perform that action at this time.
0 commit comments