Files
hate_crack/.github/workflows/version-bump.yml
Justin Bollinger de2b400f6d chore: align CI and tooling with global development standards
- Remove 6 duplicate per-version pytest workflows (matrix build covers all)
- Pin GitHub Actions to SHA hashes with version comments
- Add persist-credentials: false to checkout steps
- Replace mypy with ty for type checking (faster, stricter)
- Pin dev deps to exact versions (ty==0.0.17, ruff==0.15.1, pytest==9.0.2, pytest-cov==7.0.0)
- Remove types-* stub packages (ty doesn't need them)
- Remove stale [dependency-groups] section from pyproject.toml
- Update shell scripts to use set -euo pipefail
- Add prek.toml for git hook management (pre-push, post-commit)
- Add lint-infra.yml workflow (shellcheck + actionlint)
- Fix actionlint warning: pass github.head_ref through env var
- Track CLAUDE.md and .claude/ scripts in git
- Update README.md and Makefile references from mypy to ty

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 12:42:51 -05:00

71 lines
2.3 KiB
YAML

name: version-bump
on:
pull_request:
types: [closed]
branches: [main]
permissions:
contents: write
jobs:
bump:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0
persist-credentials: false
- name: Determine version bump type
id: bump-type
env:
BRANCH: ${{ github.head_ref }}
TITLE: ${{ github.event.pull_request.title }}
run: |
# Feature branches (feat/) bump minor, everything else bumps patch
if echo "$BRANCH" | grep -qiE '^feat/'; then
echo "type=minor" >> "$GITHUB_OUTPUT"
elif echo "$TITLE" | grep -qiE '^feat'; then
echo "type=minor" >> "$GITHUB_OUTPUT"
else
echo "type=patch" >> "$GITHUB_OUTPUT"
fi
echo "Bump type: $(grep type "$GITHUB_OUTPUT" | cut -d= -f2) (branch: $BRANCH)"
- name: Bump version
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
BUMP_TYPE="${{ steps.bump-type.outputs.type }}"
latest=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+' | head -1)
if [ -z "$latest" ]; then
echo "No version tag found, starting at v0.0.1"
next="v0.0.1"
else
version="${latest#v}"
major=$(echo "$version" | cut -d. -f1)
minor=$(echo "$version" | cut -d. -f2)
patch=$(echo "$version" | cut -d. -f3)
patch=${patch:-0}
if [ "$BUMP_TYPE" = "minor" ]; then
next="v${major}.$((minor + 1)).0"
else
next="v${major}.${minor}.$((patch + 1))"
fi
fi
echo "Tagging $next (previous: ${latest:-none}, bump: $BUMP_TYPE)"
git tag -a "$next" -m "Release $next"
git push origin "$next"
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
latest=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+' | head -1)
gh release create "$latest" --title "$latest" --notes "Release $latest" --latest