chore: fix things up

This commit is contained in:
Stevan Freeborn
2026-03-25 14:01:11 -05:00
parent 64e5bf0b72
commit b4813dfd07
4 changed files with 8 additions and 33 deletions
+2 -10
View File
@@ -1,24 +1,19 @@
name: Version
on:
push:
branches: [main]
permissions:
contents: write
jobs:
version:
name: Bump version and tag
runs-on: ubuntu-latest
# Skip if the push was a version bump commit (prevent infinite loop)
if: "!startsWith(github.event.head_commit.message, 'chore(release):')"
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Get latest tag
id: latest_tag
run: |
@@ -28,7 +23,6 @@ jobs:
fi
echo "tag=$tag" >> "$GITHUB_OUTPUT"
echo "Latest tag: $tag"
- name: Determine version bump from commits
id: bump
run: |
@@ -36,7 +30,6 @@ jobs:
current="${latest_tag#v}"
IFS='.' read -r major minor patch <<< "$current"
# Get commit messages since last tag
if git rev-parse "$latest_tag" >/dev/null 2>&1; then
commits=$(git log "$latest_tag"..HEAD --pretty=format:"%s")
else
@@ -49,6 +42,7 @@ jobs:
fi
bump="none"
while IFS= read -r msg; do
if echo "$msg" | grep -qiE '^feat(\(.+\))?!:|^[a-z]+(\(.+\))?!:|BREAKING CHANGE'; then
bump="major"
@@ -79,14 +73,12 @@ jobs:
echo "version=$new_version" >> "$GITHUB_OUTPUT"
echo "skip=false" >> "$GITHUB_OUTPUT"
echo "Bump: $bump -> v$new_version"
- name: Update Cargo.toml version
if: steps.bump.outputs.skip != 'true'
run: |
new_version="${{ steps.bump.outputs.version }}"
sed -i "s/^version = \".*\"/version = \"$new_version\"/" Cargo.toml
echo "Updated Cargo.toml to version $new_version"
- name: Commit and tag
if: steps.bump.outputs.skip != 'true'
run: |