File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020 # Checkout the repository
2121 - name : Checkout code
2222 uses : actions/checkout@v4
23+ with :
24+ fetch-depth : 0 # Fetch all history for proper tag versioning
2325
2426 # Set up Python
2527 - name : Set up Python
@@ -55,12 +57,23 @@ jobs:
5557 pyinstaller pagertree.spec
5658 shell : bash # Use bash for consistent scripting across OSes
5759
58- # Version the build ( using git tag or commit SHA)
60+ # Set version using SEMVER
5961 - name : Set version
6062 id : version
6163 run : |
62- VERSION=$(git describe --tags --always --dirty)
64+ # Get the latest tag, or default to 0.0.0 if none exists
65+ LATEST_TAG=$(git tag --sort=-v:refname | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1 || echo "0.0.0")
66+
67+ # Increment patch version
68+ IFS='.' read -r MAJOR MINOR PATCH <<< "$LATEST_TAG"
69+ NEW_PATCH=$((PATCH + 1))
70+ VERSION="$MAJOR.$MINOR.$NEW_PATCH"
71+
6372 echo "VERSION=$VERSION" >> $GITHUB_ENV
73+
74+ # Create or update the tag
75+ git tag -f "$VERSION"
76+ git push origin "$VERSION" --force
6477 shell : bash
6578
6679 # Upload artifact
You can’t perform that action at this time.
0 commit comments