From 9720eeb2986632da992b9def18654c29b76002c3 Mon Sep 17 00:00:00 2001 From: Romeo Dumitrescu Date: Fri, 9 May 2025 17:56:48 +0300 Subject: [PATCH] refactor(ci): streamline build evaluation logic in pipeline - 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. --- .github/workflows/pipeline.yaml | 45 ++++++++++----------------------- 1 file changed, 13 insertions(+), 32 deletions(-) diff --git a/.github/workflows/pipeline.yaml b/.github/workflows/pipeline.yaml index b6e708a..14bcaf9 100644 --- a/.github/workflows/pipeline.yaml +++ b/.github/workflows/pipeline.yaml @@ -95,47 +95,28 @@ jobs: - name: evaluate - build id: evaluate_build - run: | - if [ "${{ steps.pathsFilter.outputs.build }}" = "true" ] || \ - [ "${{ github.event.inputs.force_build }}" = "true" ] || \ - [ "${{ github.event.inputs.force_release }}" = "true" ]; then - result=true - else - result=false - fi - echo "result=$result" >> $GITHUB_OUTPUT + env: + RESULT: ${{ steps.pathsFilter.outputs.build == 'true' || github.event.inputs.force_build == 'true' || github.event.inputs.force_release == 'true' }} + run: echo "result=$RESULT" >> $GITHUB_OUTPUT - name: evaluate - build_push id: evaluate_build_push - run: | - if [ "${{ steps.pathsFilter.outputs.src }}" = "true" ] || \ - [ "${{ github.event.inputs.force_build }}" = "true" ]; then - result=true - else - result=false - fi - echo "result=$result" >> $GITHUB_OUTPUT + env: + RESULT: ${{ github.event_name != 'pull_request' && (steps.pathsFilter.outputs.src == 'true' || github.event.inputs.force_build == 'true') }} + run: echo "result=$RESULT" >> $GITHUB_OUTPUT - name: evaluate - build_configuration id: evaluate_build_configuration - run: | - if [ "${{ github.ref }}" = "refs/heads/main" ]; then - result=Release - else - result=Debug - fi - echo "result=$result" >> $GITHUB_OUTPUT + env: + RESULT: ${{ github.ref == 'refs/heads/main' && 'Release' || 'Debug' }} + run: echo "result=$RESULT" >> $GITHUB_OUTPUT - name: evaluate - release id: evaluate_release - run: | - if [ "${{ github.ref }}" = "refs/heads/main" ] || \ - [ "${{ github.event.inputs.force_release }}" = "true" ]; then - result=true - else - result=false - fi - echo "result=$result" >> $GITHUB_OUTPUT + env: + RESULT: ${{ github.ref == 'refs/heads/main' || github.event.inputs.force_release == 'true' }} + run: echo "result=$RESULT" >> $GITHUB_OUTPUT + build: name: build