From d06d11878284397b8731741f0f90251e8367f8e7 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Wed, 27 Aug 2025 17:17:53 +0200 Subject: [PATCH 1/3] Added workflow to auto deploy master to test node --- .github/workflows/deploy-testnet.yml | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/deploy-testnet.yml diff --git a/.github/workflows/deploy-testnet.yml b/.github/workflows/deploy-testnet.yml new file mode 100644 index 000000000..61278efdd --- /dev/null +++ b/.github/workflows/deploy-testnet.yml @@ -0,0 +1,29 @@ +name: Deploy to Testnet + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + types: [ closed ] + +jobs: + trigger-deploy: + if: github.event_name == 'push' || (github.event.pull_request.merged == true) + runs-on: ubuntu-latest + steps: + - name: Trigger deploy workflow + uses: peter-evans/repository-dispatch@v3 + with: + token: ${{ secrets.DEPLOY_TRIGGER_TOKEN }} + repository: magicblock-labs/validator-deployment + event-type: auto-deploy + client-payload: | + { + "project": "magicblock-validator", + "deploy_target": "testnet", + "branch": "master", + "triggered_by": "${{ github.actor }}", + "source_repo": "${{ github.repository }}", + "source_sha": "${{ github.sha }}" + } \ No newline at end of file From ea37417eba4fb0b19413b294ffd1b4750703e211 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Wed, 27 Aug 2025 17:22:27 +0200 Subject: [PATCH 2/3] added missing new line at end of file --- .github/workflows/deploy-testnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-testnet.yml b/.github/workflows/deploy-testnet.yml index 61278efdd..3b928403a 100644 --- a/.github/workflows/deploy-testnet.yml +++ b/.github/workflows/deploy-testnet.yml @@ -26,4 +26,4 @@ jobs: "triggered_by": "${{ github.actor }}", "source_repo": "${{ github.repository }}", "source_sha": "${{ github.sha }}" - } \ No newline at end of file + } From cd892674a876e2494419666def63ccae9b9ba695 Mon Sep 17 00:00:00 2001 From: Luca Cillario Date: Tue, 2 Sep 2025 16:29:46 +0200 Subject: [PATCH 3/3] Internalized the action that performs the repository dispatch --- .../actions/repository-dispatch/action.yml | 33 +++++++++++++++++++ .github/workflows/deploy-testnet.yml | 17 ++++------ 2 files changed, 40 insertions(+), 10 deletions(-) create mode 100644 .github/actions/repository-dispatch/action.yml diff --git a/.github/actions/repository-dispatch/action.yml b/.github/actions/repository-dispatch/action.yml new file mode 100644 index 000000000..4ab906dca --- /dev/null +++ b/.github/actions/repository-dispatch/action.yml @@ -0,0 +1,33 @@ +name: 'Internal Repository Dispatch' +description: 'Trigger repository dispatch events' +inputs: + token: + description: 'GitHub token' + required: true + repository: + description: 'Repository in format owner/repo' + required: true + event-type: + description: 'Event type to trigger' + required: true + client-payload: + description: 'JSON payload' + required: false + default: '{}' + +runs: + using: 'composite' + steps: + - name: Trigger repository dispatch + shell: bash + run: | + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ inputs.token }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/${{ inputs.repository }}/dispatches \ + -d '{ + "event_type": "${{ inputs.event-type }}", + "client_payload": ${{ inputs.client-payload }} + }' \ No newline at end of file diff --git a/.github/workflows/deploy-testnet.yml b/.github/workflows/deploy-testnet.yml index 3b928403a..5efd2a3bf 100644 --- a/.github/workflows/deploy-testnet.yml +++ b/.github/workflows/deploy-testnet.yml @@ -12,18 +12,15 @@ jobs: if: github.event_name == 'push' || (github.event.pull_request.merged == true) runs-on: ubuntu-latest steps: + - name: Checkout this magicblock-validator + uses: actions/checkout@v2 + with: + path: magicblock-validator + - name: Trigger deploy workflow - uses: peter-evans/repository-dispatch@v3 + uses: ./magicblock-validator/.github/actions/repository-dispatch with: token: ${{ secrets.DEPLOY_TRIGGER_TOKEN }} repository: magicblock-labs/validator-deployment event-type: auto-deploy - client-payload: | - { - "project": "magicblock-validator", - "deploy_target": "testnet", - "branch": "master", - "triggered_by": "${{ github.actor }}", - "source_repo": "${{ github.repository }}", - "source_sha": "${{ github.sha }}" - } + client-payload: '{"project": "magicblock-validator", "deploy_target": "testnet", "branch": "master", "triggered_by": "${{ github.actor }}", "source_repo": "${{ github.repository }}", "source_sha": "${{ github.sha }}"}'