From 3bead17c3163583d14b065245473cfb51ae1793a Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 25 Jul 2024 12:15:29 +0100 Subject: [PATCH] feat: trigger internal CI on master commit --- .github/workflows/on-master-commit.yaml | 1 + .github/workflows/publish-docker-images.yaml | 30 +++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/.github/workflows/on-master-commit.yaml b/.github/workflows/on-master-commit.yaml index c962abf8d..95addefd4 100644 --- a/.github/workflows/on-master-commit.yaml +++ b/.github/workflows/on-master-commit.yaml @@ -62,6 +62,7 @@ jobs: tags: | type=raw,value=master-${{ needs.generate-tags.outputs.tag_date }}-${{ needs.generate-tags.outputs.short_sha }} type=raw,value=master-latest + trigger_internal_ci: true notify-slack: name: Notify Slack diff --git a/.github/workflows/publish-docker-images.yaml b/.github/workflows/publish-docker-images.yaml index abd1958b4..95e828716 100644 --- a/.github/workflows/publish-docker-images.yaml +++ b/.github/workflows/publish-docker-images.yaml @@ -15,7 +15,18 @@ on: type: string required: true description: 'The images to publish' + trigger_internal_ci: + description: 'Trigger the internal CI' + required: false + type: boolean + default: false workflow_dispatch: + inputs: + trigger_internal_ci: + description: 'Trigger the internal CI' + required: true + type: boolean + default: false jobs: build-and-push-image: @@ -66,7 +77,7 @@ jobs: tags: ${{ inputs.tags || format('type=raw,value={0}-{1}', github.ref_name, github.sha) }} - name: Push to Registry(s) - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: context: . platforms: ${{ github.event_name != 'pull_request' && 'linux/amd64,linux/arm64' || 'linux/amd64' }} @@ -84,3 +95,20 @@ jobs: annotations: true severity: LOW dockerfile: ./Dockerfile + + trigger_ci: + runs-on: ubuntu-latest + needs: + - build-and-push-image + if: ${{ inputs.trigger_internal_ci }} + steps: + - name: Internal CI + uses: peter-evans/repository-dispatch@v3 + with: + token: ${{ secrets.INTERNAL_CI_TOKEN }} + repository: vechain/thor-internal-ci + event-type: internal-thor-ci + client-payload: | + { + "thor_image": ${{ fromJSON(steps.build-and-push-image.outputs.meta.json).tags[0] }} + }