diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 07c53431..d37c088d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,3 +60,49 @@ jobs: project_name: ${{ matrix.project_name }} branch: ${{ matrix.branch }} secrets: inherit + + promote: + needs: + - get_version + - build + runs-on: ubuntu-26.04 + permissions: {} + strategy: + fail-fast: false + matrix: + include: + - repo: OpenVoxProject/openvox + branch: main + - repo: OpenVoxProject/openvox + branch: '8.x' + - repo: OpenVoxProject/openbolt + branch: main + steps: + - name: Trigger promote workflow in ${{ matrix.repo }} (${{ matrix.branch }}) + id: dispatch + env: + GH_TOKEN: ${{ secrets.OPENVOXBOT_TRIGGER_WORKFLOWS }} + REPO: ${{ matrix.repo }} + BRANCH: ${{ matrix.branch }} + VERSION: ${{ needs.get_version.outputs.version }} + run: | + # return_run_details makes the API respond with the run id and URL + response=$(gh api --method POST \ + "repos/${REPO}/actions/workflows/promote.yml/dispatches" \ + -f ref=main \ + -F return_run_details=true \ + -f 'inputs[component]=puppet-runtime' \ + -f "inputs[ref]=${VERSION}" \ + -f "inputs[branch]=${BRANCH}") + run_id=$(jq -r '.workflow_run_id' <<< "${response}") + run_url=$(jq -r '.html_url' <<< "${response}") + echo "run_id=${run_id}" >> "$GITHUB_OUTPUT" + echo "Triggered ${run_url}" + echo "- [${REPO} (${BRANCH})](${run_url})" >> "$GITHUB_STEP_SUMMARY" + + - name: Wait for promote workflow in ${{ matrix.repo }} (${{ matrix.branch }}) + env: + GH_TOKEN: ${{ secrets.OPENVOXBOT_TRIGGER_WORKFLOWS }} + REPO: ${{ matrix.repo }} + RUN_ID: ${{ steps.dispatch.outputs.run_id }} + run: gh run watch "${RUN_ID}" --repo "${REPO}" --exit-status