From 0a94b48e8b8fde9477e6fb25969a345f259c8660 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Tue, 7 May 2024 17:40:06 -0700 Subject: [PATCH 1/3] 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" }' From 13871fb230c408765c205402a8e9e1909dbac13b Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Tue, 7 May 2024 17:43:37 -0700 Subject: [PATCH 2/3] Fix branch ref in CI --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index df7859387a..47eb921566 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -82,7 +82,7 @@ jobs: name: Trigger downstream builds needs: [build] # Only for pushes to default branch - if: ${{ github.event_name == 'push' && github.event.ref_name == github.event.repository.default_branch }} + if: ${{ github.event_name == 'push' && github.ref_name == github.event.repository.default_branch }} uses: ./.github/workflows/trigger_dep_builds.yml secrets: token: ${{ secrets.REPO_DISPATCH }} From d3afc9ecc8a8ca672d86dbac53a021dd011eb496 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Tue, 7 May 2024 17:49:14 -0700 Subject: [PATCH 3/3] Fix dispatch event name --- .github/workflows/trigger_dep_builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/trigger_dep_builds.yml b/.github/workflows/trigger_dep_builds.yml index 57587244f8..5e4b919158 100644 --- a/.github/workflows/trigger_dep_builds.yml +++ b/.github/workflows/trigger_dep_builds.yml @@ -24,6 +24,6 @@ jobs: with: token: ${{ secrets.token }} repository: ${{ matrix.repo }} - event-type: jackson-databind-pushed + event-type: jackson-core-pushed # Could push information on what was built but not yet client-payload: '{"version": "N/A" }'