From 2ec4c5d51b08134e03fd353bb7d316e75add2045 Mon Sep 17 00:00:00 2001 From: Vladimir Ischenko Date: Sat, 14 Dec 2024 12:11:29 +0300 Subject: [PATCH] Update cron-build.yml --- .github/workflows/cron-build.yml | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cron-build.yml b/.github/workflows/cron-build.yml index 3ad3210bb7..e3a4a4eee7 100644 --- a/.github/workflows/cron-build.yml +++ b/.github/workflows/cron-build.yml @@ -3,6 +3,9 @@ name: 4testing multiarch-cron-build on: schedule: - cron: '0 20 * * *' + push: + branches: + - 'feature/cron-build-oci' jobs: @@ -26,7 +29,11 @@ jobs: echo "$all_branches" | grep '^develop$' } | sed 's/^/"/; s/$/"/' ) - echo "json_output=[${matching_branches//$'\n'/,}]" >> $GITHUB_OUTPUT + + json_output="[${matching_branches//$'\n'/, }]" + json_output="${json_output//\"/\\\"}" + echo "json_output=$json_output" >> $GITHUB_OUTPUT + echo "branches=${matching_branches//$'\n'/ }" | tr -d '[]\"' >> $GITHUB_OUTPUT - name: Determine Priority Branch @@ -48,19 +55,30 @@ jobs: echo "build_deb=$(echo "${CHANGED_FILES}" | grep -qE '^install/common/|^install/deb/' && echo true || echo false)" >> $GITHUB_OUTPUT echo "build_rpm=$(echo "${CHANGED_FILES}" | grep -qE '^install/common/|^install/rpm/' && echo true || echo false)" >> $GITHUB_OUTPUT + + - name: Dispatch Action main build run: | + branches_json='${{ steps.list-branches.outputs.json_output }}' + json_payload=$(jq -n \ + --arg ref "feature/cron-build-oci" \ + --arg branches "$branches_json" \ + '{ + ref: $ref, + inputs: { + branches: $branches + } + }') + echo "Payload for curl:" + echo "$json_payload" | jq . + curl \ -X POST \ -u "${{ secrets.USERNAME }}:${{ secrets.TOKEN }}" \ "https://api.github.com/repos/ONLYOFFICE/DocSpace-buildtools/actions/workflows/75421046/dispatches" \ -H "Accept: application/vnd.github+json" \ - --data '{ - "ref": "'"${{ github.ref_name }}"'", - "inputs": { - "branches": "[\"develop\", \"hotfix/v3.0.1\", \"release/v3.0.0\"]" - } - }' + -H "Content-Type: application/json" \ + --data "$json_payload" - name: Dispatch Action build packages if: ${{ github.event_name == 'schedule' && steps.priority.outputs.target_branch != '' && (steps.changes.outputs.build_deb == 'true' || steps.changes.outputs.build_rpm == 'true') }}