Skip to content

Commit 36f3084

Browse files
authored
Merge pull request #1319 from nebius/release-1.21.10/bump-version-2
Fix bump version detection
2 parents ad250ce + 18de68f commit 36f3084

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

.github/workflows/one_job.yml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ jobs:
4949

5050
- name: Checkout repository
5151
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
52+
with:
53+
fetch-depth: 0 # Fetch git history for the VERSION file changes detection
5254

5355
- name: Install GO
5456
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
@@ -58,21 +60,20 @@ jobs:
5860

5961
- name: Generate version file
6062
run: |
61-
# Check if VERSION file was changed in this push
62-
VERSION_CHANGED="false"
63-
if [ "${{ github.event_name }}" == "push" ]; then
64-
# Get the list of changed files
65-
git diff --name-only HEAD^ HEAD | grep -q "^VERSION$" && VERSION_CHANGED="true"
63+
UNSTABLE="true"
64+
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" =~ ^refs/heads/soperator-release- ]]; then
65+
CHANGED_FILES=$(git diff --name-only HEAD^ HEAD) || {
66+
echo "Error: git diff failed with exit code $?"
67+
exit 1
68+
}
69+
70+
if echo "$CHANGED_FILES" | grep -q "^VERSION$"; then
71+
UNSTABLE="false"
72+
fi
6673
fi
6774
68-
# Build stable releases only on main/release branches when VERSION changes
69-
if [[ ("${{ github.ref }}" == "refs/heads/main" || "${{ github.ref }}" =~ "^refs/heads/soperator-release-") && "$VERSION_CHANGED" == "true" ]]; then
70-
make get-version UNSTABLE=false >> version.txt
71-
echo "false" >> version.txt
72-
else
73-
make get-version UNSTABLE=true >> version.txt
74-
echo "true" >> version.txt
75-
fi
75+
make get-version UNSTABLE=${UNSTABLE} >> version.txt
76+
echo "${UNSTABLE}" >> version.txt
7677
7778
- name: Upload version file
7879
uses: actions/upload-artifact@v4

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
1.21.10
2+

0 commit comments

Comments
 (0)