From 0a94b48e8b8fde9477e6fb25969a345f259c8660 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Tue, 7 May 2024 17:40:06 -0700 Subject: [PATCH] Refactor downstream re-build CI --- .github/workflows/main.yml | 23 ++++--------------- .github/workflows/trigger_dep_builds.yml | 29 ++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/trigger_dep_builds.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d7c4b2385d..df7859387a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -81,21 +81,8 @@ jobs: trigger-dep-build: name: Trigger downstream builds needs: [build] - if: ${{ github.event_name == 'push' }} - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - repo: [ 'FasterXML/jackson-databind' ] - - steps: - - name: Repository dispatch - uses: peter-evans/repository-dispatch@v3 - with: - # Does regular token work within same org? - token: ${{ secrets.REPO_DISPATCH }} - repository: ${{ matrix.repo }} - event-type: jackson-core-pushed - # Could push information on what was built but not yet - client-payload: '{"version": "N/A" }' + # Only for pushes to default branch + if: ${{ github.event_name == 'push' && github.event.ref_name == github.event.repository.default_branch }} + uses: ./.github/workflows/trigger_dep_builds.yml + secrets: + token: ${{ secrets.REPO_DISPATCH }} diff --git a/.github/workflows/trigger_dep_builds.yml b/.github/workflows/trigger_dep_builds.yml new file mode 100644 index 0000000000..57587244f8 --- /dev/null +++ b/.github/workflows/trigger_dep_builds.yml @@ -0,0 +1,29 @@ +# Reusable workflow; extracted for maintainability + +name: Trigger downstream builds +on: + workflow_call: + secrets: + token: + required: true + +jobs: + trigger-dep-build: + name: Trigger downstream builds + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + repo: + - 'FasterXML/jackson-databind' + + steps: + - name: Repository dispatch + uses: peter-evans/repository-dispatch@v3 + with: + token: ${{ secrets.token }} + repository: ${{ matrix.repo }} + event-type: jackson-databind-pushed + # Could push information on what was built but not yet + client-payload: '{"version": "N/A" }'