Skip to content

Commit a8b3c0d

Browse files
committed
[skip-ci] test
1 parent 11ebe0c commit a8b3c0d

File tree

1 file changed

+41
-35
lines changed

1 file changed

+41
-35
lines changed

.github/workflows/build.yml

Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,47 @@ jobs:
1616
steps:
1717
- name: Checkout
1818
uses: actions/checkout@v4
19-
19+
20+
- name: Check Build Flags First
21+
id: check_flags
22+
run: |
23+
MESSAGE=$(git log -1 --pretty=%B)
24+
echo "Last commit message: $MESSAGE"
25+
26+
if echo "$MESSAGE" | grep -qE "\[skip-ci\]|\[no-ci\]"; then
27+
echo "Detected skip CI flag, setting both platforms to false"
28+
echo "run_linux=false" >> $GITHUB_OUTPUT
29+
echo "run_windows=false" >> $GITHUB_OUTPUT
30+
echo "skip_version_bump=true" >> $GITHUB_OUTPUT
31+
else
32+
if echo "$MESSAGE" | grep -q "\[no-linux\]"; then
33+
echo "Skipping Linux build"
34+
echo "run_linux=false" >> $GITHUB_OUTPUT
35+
else
36+
echo "Running Linux build"
37+
echo "run_linux=true" >> $GITHUB_OUTPUT
38+
fi
39+
40+
if echo "$MESSAGE" | grep -q "\[no-win\]"; then
41+
echo "Skipping Windows build"
42+
echo "run_windows=false" >> $GITHUB_OUTPUT
43+
else
44+
echo "Running Windows build"
45+
echo "run_windows=true" >> $GITHUB_OUTPUT
46+
fi
47+
echo "skip_version_bump=false" >> $GITHUB_OUTPUT
48+
fi
49+
2050
- name: Increment APP_VERSION
51+
if: steps.check_flags.outputs.skip_version_bump != 'true'
2152
run: |
2253
VERSION=$(cat APP_VERSION)
2354
BASE=$(echo "$VERSION" | sed 's/-.*//')
2455
SUFFIX=$(echo "$VERSION" | grep -oP '(?<=-).*' || echo "")
2556
IFS='.' read -r -a PARTS <<< "$BASE"
26-
57+
2758
LAST_COMMIT_MESSAGE=$(git log -1 --pretty=%B)
28-
59+
2960
if echo "$LAST_COMMIT_MESSAGE" | grep -q "\[MAJOR\]"; then
3061
PARTS[0]=$((PARTS[0]+1))
3162
PARTS[1]=0
@@ -36,62 +67,37 @@ jobs:
3667
elif echo "$LAST_COMMIT_MESSAGE" | grep -q "\[PATCH\]"; then
3768
PARTS[2]=$((PARTS[2]+1))
3869
fi
39-
70+
4071
PARTS[3]=$((PARTS[3]+1)) # always bump build number
41-
72+
4273
NEW_VERSION="${PARTS[0]}.${PARTS[1]}.${PARTS[2]}.${PARTS[3]}"
4374
if [ -n "$SUFFIX" ]; then
4475
NEW_VERSION="$NEW_VERSION-$SUFFIX"
4576
fi
4677
echo "$NEW_VERSION" > APP_VERSION
78+
4779
- name: Bump resource.rc
80+
if: steps.check_flags.outputs.skip_version_bump != 'true'
4881
run: |
4982
cd scripts/shared
5083
python3 updateversion.py
5184
cd ../..
5285
5386
- name: Commit updated APP_VERSION
87+
if: steps.check_flags.outputs.skip_version_bump != 'true'
5488
run: |
5589
git config user.name "github-actions[bot]"
5690
git config user.email "github-actions[bot]@users.noreply.github.com"
5791
git add APP_VERSION
5892
git add resource.rc
5993
git commit -m "ci: bump version"
6094
git push
61-
95+
6296
- name: Get Version
6397
id: get_version
6498
run: |
6599
echo "version=$(cat APP_VERSION)" >> $GITHUB_OUTPUT
66-
67-
- name: Check Build Flags
68-
id: check_flags
69-
run: |
70-
MESSAGE=$(git log -1 --pretty=%B)
71-
echo "Last commit message: $MESSAGE"
72-
73-
if echo "$MESSAGE" | grep -qE "\[skip-ci\]|\[no-ci\]"; then
74-
echo "Detected skip CI flag, setting both platforms to false"
75-
echo "run_linux=false" >> $GITHUB_OUTPUT
76-
echo "run_windows=false" >> $GITHUB_OUTPUT
77-
else
78-
if echo "$MESSAGE" | grep -q "\[no-linux\]"; then
79-
echo "Skipping Linux build"
80-
echo "run_linux=false" >> $GITHUB_OUTPUT
81-
else
82-
echo "Running Linux build"
83-
echo "run_linux=true" >> $GITHUB_OUTPUT
84-
fi
85-
86-
if echo "$MESSAGE" | grep -q "\[no-win\]"; then
87-
echo "Skipping Windows build"
88-
echo "run_windows=false" >> $GITHUB_OUTPUT
89-
else
90-
echo "Running Windows build"
91-
echo "run_windows=true" >> $GITHUB_OUTPUT
92-
fi
93-
fi
94-
100+
95101
windows_build:
96102
needs: prebuild
97103
if: needs.prebuild.outputs.run_windows == 'true'

0 commit comments

Comments
 (0)