Skip to content

Commit 7266ce9

Browse files
authored
refactor(ci): streamline build evaluation logic in pipeline (#505)
- Simplifies the logic for build evaluation by using environment variables instead of shell scripting. - Reduces redundancy in the evaluation steps for build, build_push, build_configuration, and release. - Improves clarity and maintainability of the CI configuration.
1 parent ea105b0 commit 7266ce9

File tree

1 file changed

+13
-32
lines changed

1 file changed

+13
-32
lines changed

.github/workflows/pipeline.yaml

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -95,47 +95,28 @@ jobs:
9595
9696
- name: evaluate - build
9797
id: evaluate_build
98-
run: |
99-
if [ "${{ steps.pathsFilter.outputs.build }}" = "true" ] || \
100-
[ "${{ github.event.inputs.force_build }}" = "true" ] || \
101-
[ "${{ github.event.inputs.force_release }}" = "true" ]; then
102-
result=true
103-
else
104-
result=false
105-
fi
106-
echo "result=$result" >> $GITHUB_OUTPUT
98+
env:
99+
RESULT: ${{ steps.pathsFilter.outputs.build == 'true' || github.event.inputs.force_build == 'true' || github.event.inputs.force_release == 'true' }}
100+
run: echo "result=$RESULT" >> $GITHUB_OUTPUT
107101

108102
- name: evaluate - build_push
109103
id: evaluate_build_push
110-
run: |
111-
if [ "${{ steps.pathsFilter.outputs.src }}" = "true" ] || \
112-
[ "${{ github.event.inputs.force_build }}" = "true" ]; then
113-
result=true
114-
else
115-
result=false
116-
fi
117-
echo "result=$result" >> $GITHUB_OUTPUT
104+
env:
105+
RESULT: ${{ github.event_name != 'pull_request' && (steps.pathsFilter.outputs.src == 'true' || github.event.inputs.force_build == 'true') }}
106+
run: echo "result=$RESULT" >> $GITHUB_OUTPUT
118107

119108
- name: evaluate - build_configuration
120109
id: evaluate_build_configuration
121-
run: |
122-
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
123-
result=Release
124-
else
125-
result=Debug
126-
fi
127-
echo "result=$result" >> $GITHUB_OUTPUT
110+
env:
111+
RESULT: ${{ github.ref == 'refs/heads/main' && 'Release' || 'Debug' }}
112+
run: echo "result=$RESULT" >> $GITHUB_OUTPUT
128113

129114
- name: evaluate - release
130115
id: evaluate_release
131-
run: |
132-
if [ "${{ github.ref }}" = "refs/heads/main" ] || \
133-
[ "${{ github.event.inputs.force_release }}" = "true" ]; then
134-
result=true
135-
else
136-
result=false
137-
fi
138-
echo "result=$result" >> $GITHUB_OUTPUT
116+
env:
117+
RESULT: ${{ github.ref == 'refs/heads/main' || github.event.inputs.force_release == 'true' }}
118+
run: echo "result=$RESULT" >> $GITHUB_OUTPUT
119+
139120

140121
build:
141122
name: build

0 commit comments

Comments
 (0)