Skip to content

Commit bd9d080

Browse files
committed
Fixes to GitHub Action
Signed-off-by: stavrosvl7 <[email protected]>
1 parent 9511616 commit bd9d080

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

.github/workflows/semver-checks.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,26 @@ jobs:
4646
- name: Get latest version tag
4747
id: get-baseline
4848
run: |
49-
# Find the latest version tag
49+
# Find the latest version tag (v0.1.0 or higher)
5050
latest_tag=$(git describe --tags --abbrev=0 --match='v*' 2>/dev/null || echo "")
5151
if [ -z "$latest_tag" ]; then
5252
echo "No version tags found - skipping semver check"
5353
echo "This is normal for new projects or templates"
5454
echo "skip=true" >> $GITHUB_OUTPUT
5555
else
56-
echo "Found baseline tag: $latest_tag"
57-
echo "baseline_rev=$latest_tag" >> $GITHUB_OUTPUT
58-
echo "skip=false" >> $GITHUB_OUTPUT
56+
# Extract version without 'v' prefix for comparison
57+
version=${latest_tag#v}
58+
59+
# Check if version is >= 0.1.0 (using semver comparison)
60+
if printf '%s\n%s\n' "0.1.0" "$version" | sort -V | head -n1 | grep -q "^0\.1\.0$"; then
61+
echo "Found suitable baseline tag: $latest_tag (>= v0.1.0)"
62+
echo "baseline_rev=$latest_tag" >> $GITHUB_OUTPUT
63+
echo "skip=false" >> $GITHUB_OUTPUT
64+
else
65+
echo "Found tag $latest_tag but it's < v0.1.0 - skipping semver check"
66+
echo "Semver checking typically starts from v0.1.0 when APIs stabilize"
67+
echo "skip=true" >> $GITHUB_OUTPUT
68+
fi
5969
fi
6070
6171
- name: Check semver compatibility
@@ -69,8 +79,11 @@ jobs:
6979
- name: Semver check skipped
7080
if: steps.get-baseline.outputs.skip == 'true'
7181
run: |
72-
echo "✅ Semver check skipped - no previous version tags found"
82+
echo "✅ Semver check skipped - no suitable version tags found"
7383
echo "To enable semver checking:"
74-
echo "1. Tag your first release: git tag v0.1.0"
84+
echo "1. Tag your first stable release: git tag v0.1.0"
7585
echo "2. Push the tag: git push origin v0.1.0"
76-
echo "3. Future changes will be checked against tagged versions"
86+
echo "3. Future changes will be checked against tagged versions"
87+
echo ""
88+
echo "Note: Semver checking starts from v0.1.0 as this indicates"
89+
echo "the beginning of API stability commitments in Rust projects"

0 commit comments

Comments
 (0)