Skip to content

Commit 5173d88

Browse files
authored
ci: expect rai-core version bump on changes (#692)
1 parent baace12 commit 5173d88

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Require Version Bump
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
paths:
8+
- 'src/rai_core/pyproject.toml'
9+
- 'src/rai_core/**'
10+
11+
jobs:
12+
require-version-bump:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Get rai_core version from BASE and HEAD
22+
id: require-version-bump
23+
run: |
24+
BASE_SHA=${{ github.event.pull_request.base.sha }}
25+
HEAD_SHA=${{ github.event.pull_request.head.sha }}
26+
FILE_PATH="src/rai_core/pyproject.toml"
27+
28+
git show $BASE_SHA:$FILE_PATH > base.txt || echo "BASE file not found"
29+
git show $HEAD_SHA:$FILE_PATH > head.txt || echo "HEAD file not found"
30+
31+
- name: Compare version lines
32+
run: |
33+
BASE_VERSION=$(grep '^version =' base.txt || echo "MISSING")
34+
HEAD_VERSION=$(grep '^version =' head.txt || echo "MISSING")
35+
36+
echo "BASE: $BASE_VERSION"
37+
echo "HEAD: $HEAD_VERSION"
38+
39+
if [ "$BASE_VERSION" = "$HEAD_VERSION" ]; then
40+
echo "❌ Version has not changed. Please bump the version in the pyproject.toml file according to Semantic Versioning."
41+
exit 1
42+
else
43+
echo "✅ Version changed."
44+
fi

0 commit comments

Comments
 (0)