sdk-update #148
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy on sdk update | |
on: | |
repository_dispatch: | |
types: [sdk-update] | |
jobs: | |
update-sdk: | |
runs-on: ubicloud | |
outputs: | |
commit_hash: ${{ steps.get_commit.outputs.commit_hash }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
submodules: 'recursive' | |
- name: Bump protocol sdk | |
run: | | |
git submodule update --remote | |
git config user.name "GitHub Actions" | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
git add protocol | |
git commit --allow-empty -m "Bumping protocol sdk to ${{ github.event.client_payload.version }}" | |
git push | |
- name: Get latest commit hash | |
id: get_commit | |
run: echo "commit_hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
emit-dispatch-events: | |
runs-on: ubicloud | |
needs: [update-sdk] | |
if: ${{ github.ref == 'refs/heads/master' }} | |
strategy: | |
matrix: | |
repo: | |
[ | |
"dlob-server", | |
"internal-keeper-bot", | |
"history-server" | |
] | |
steps: | |
- name: Checkout code with new updated version | |
uses: actions/checkout@v2 | |
with: | |
submodules: 'recursive' | |
- name: Emit dispatch event | |
run: | | |
curl -X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: token ${{ secrets.GH_PAT }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
"https://api.github.com/repos/drift-labs/${{ matrix.repo }}/dispatches" \ | |
-d "{\"event_type\": \"drift-common-update\", \"client_payload\": { | |
\"version\": \"$VERSION\", | |
\"commit\": \"${{ needs.update-sdk.outputs.commit_hash }}\" | |
}}" | |
env: | |
GH_PAT: ${{ secrets.GH_PAT }} | |
VERSION: ${{ github.event.client_payload.version }} |