|
43 | 43 | run: shellcheck run |
44 | 44 |
|
45 | 45 | version-bump-check: |
46 | | - name: Version bump check |
47 | | - runs-on: ubuntu-latest |
48 | | - steps: |
49 | | - - uses: actions/checkout@v4 |
50 | | - with: |
51 | | - fetch-depth: 0 |
52 | | - |
53 | | - - name: Check VERSION bumped since last stable release |
54 | | - run: | |
55 | | - BASE_SHA=$(git merge-base origin/main HEAD) |
56 | | - CHANGED_FILES=$(git diff --name-only "$BASE_SHA"...HEAD) |
57 | | -
|
58 | | - CURRENT_VERSION=$(cat VERSION | tr -d '[:space:]') |
59 | | -
|
60 | | - # Find latest published stable release (excludes drafts and pre-releases). |
61 | | - # Draft releases create git tags, so git tag -l alone is insufficient. |
62 | | - LATEST_STABLE_TAG=$(gh release list --exclude-drafts --exclude-pre-releases \ |
63 | | - --json tagName --jq '.[].tagName' \ |
64 | | - | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?\+[0-9]+$' \ |
65 | | - | sort -V | tail -1 || true) |
66 | | -
|
67 | | - if [ -n "$LATEST_STABLE_TAG" ]; then |
68 | | - TAGGED_VERSION=$(echo "$LATEST_STABLE_TAG" | sed 's/^v\(.*\)+[0-9]*$/\1/') |
69 | | -
|
70 | | - if [ "$CURRENT_VERSION" != "$TAGGED_VERSION" ]; then |
71 | | - echo "VERSION ($CURRENT_VERSION) differs from latest stable release ($TAGGED_VERSION) — no bump needed" |
72 | | - else |
73 | | - # VERSION matches latest stable tag — check if package-affecting files changed |
74 | | - PACKAGE_FILES=$(echo "$CHANGED_FILES" \ |
75 | | - | grep -v -E '^(VERSION$|.*\.md$|docs/|\.github/|\.devcontainer/|\.vscode/|\.claude/)' \ |
76 | | - | grep -v -E '^(lefthook\.yml$|\.bumpversion\.cfg$|\.gitignore$|\.editorconfig$|LICENSE)' \ |
77 | | - | grep -v -E '^(tests?/|__tests__/|e2e/|.*\.test\.[^/]+$|.*\.spec\.[^/]+$)' \ |
78 | | - | grep -v -E '^(docker/|Dockerfile|docker-compose|config\.)' \ |
79 | | - | grep -v -E '^(tools/|run$|Makefile$|Taskfile\.yml$)' \ |
80 | | - | grep -v -E '\.(lock)$' \ |
81 | | - | grep -v -E '\.lintian-overrides$' \ |
82 | | - || true) |
83 | | -
|
84 | | - if [ -n "$PACKAGE_FILES" ]; then |
85 | | - echo "::error::Package-affecting files changed but VERSION ($CURRENT_VERSION) still matches the latest stable release ($LATEST_STABLE_TAG)." |
86 | | - echo "" |
87 | | - echo "Changed package files:" |
88 | | - echo "$PACKAGE_FILES" | sed 's/^/ /' |
89 | | - echo "" |
90 | | - echo "VERSION needs to be bumped before the next release." |
91 | | - exit 1 |
92 | | - fi |
93 | | - fi |
94 | | - else |
95 | | - echo "No stable release tags found — skipping version check" |
96 | | - fi |
| 46 | + uses: hatlabs/shared-workflows/.github/workflows/version-bump-check.yml@main |
0 commit comments