55 - main
66
77jobs :
8- Build_tox :
8+ Generate-frameworks-releases :
99 runs-on : ubuntu-latest
1010 steps :
1111 - name : Check out repository code
@@ -14,17 +14,34 @@ jobs:
1414 fetch-depth : 0
1515 fetch-tags : true
1616
17- - name : Get commit count since last tag
18- id : commit_count_step
17+ - name : Get latest tag and calculate new version
18+ id : set_version
1919 run : |
20- LAST_TAG=$(git describe --tags --abbrev=0)
21- # If no previous tag exists, count from the beginning
22- if [ -z "$LAST_TAG" ]; then
23- COUNT=$(git rev-list --count HEAD)
20+ # Fetch all tags
21+ git fetch --tags
22+
23+ # Get the latest semantic version tag
24+ LATEST_TAG=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)
25+ if [ -z "$LATEST_TAG" ]; then
26+ echo "No existing SemVer tag found, starting with v1.0.0"
27+ NEW_VERSION="v1.0.0"
2428 else
25- COUNT=$(git rev-list --count $LAST_TAG..HEAD)
29+ echo "Latest tag found: $LATEST_TAG"
30+ # Remove 'v' prefix for version manipulation
31+ CURRENT_VERSION=${LATEST_TAG:1}
32+ MAJOR=$(echo $CURRENT_VERSION | cut -d. -f1)
33+ MINOR=$(echo $CURRENT_VERSION | cut -d. -f2)
34+
35+ # Append commit count as a build metadata (optional, based on your need for a unique ID)
36+ # You might use the count since the last tag here
37+ COMMIT_COUNT=$(git rev-list HEAD ^$LATEST_TAG --count)
38+ NEW_VERSION="v$MAJOR.$MINOR.$PATCH+$COMMIT_COUNT"
39+
40+ # If you just want a clean SemVer tag without commit count metadata:
41+ # NEW_VERSION="v$MAJOR.$MINOR.$COMMIT_COUNT"
2642 fi
27- echo "COMMIT_COUNT=$COUNT" >> $GITHUB_OUTPUT
43+
44+ echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_OUTPUT
2845
2946 - name : Set up Python
3047 uses : actions/setup-python@v5 # Use the latest version
@@ -34,11 +51,13 @@ jobs:
3451 - name : Build SudoFrameworks
3552 run : python main.py
3653
37- - name : Create Release
38- uses : actions/create-release@v1
39- env :
40- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
54+ - name : Create GitHub Release and upload assets
55+ uses : softprops/action-gh-release@v1
4156 with :
42- tag_name : ${{ github.ref }}
43- release_name : Release ${{ github.ref_name }}
44- files : ./release/sudoFrameworks.json
57+ files : ./release/* # Upload all files in the build directory
58+ tag_name : ${{ steps.set_version.outputs.NEW_VERSION }}
59+ name : Release ${{ steps.set_version.outputs.NEW_VERSION }}
60+ draft : false
61+ prerelease : false
62+ env :
63+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # Use the default GITHUB_TOKEN
0 commit comments