Skip to content

Commit a8e912d

Browse files
committed
Use sem versioning for our package releases
1 parent 2157a31 commit a8e912d

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
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

0 commit comments

Comments
 (0)