Skip to content

Commit 9631c63

Browse files
authored
chore(ci): allow to dispatch deploy from realtime repo (#1915)
1 parent 38acf3b commit 9631c63

2 files changed

Lines changed: 47 additions & 22 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Dispatch Deploy
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version to deploy (no leading v). Leave blank to let the downstream pick the latest release. Example: 2.94.1'
8+
required: false
9+
type: string
10+
workflow_call:
11+
inputs:
12+
version:
13+
description: 'Version to deploy (no leading v).'
14+
required: true
15+
type: string
16+
17+
permissions: {}
18+
19+
jobs:
20+
dispatch:
21+
runs-on: blacksmith-2vcpu-ubuntu-2404
22+
steps:
23+
- name: Generate GitHub App token
24+
id: app-token
25+
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
26+
with:
27+
app-id: ${{ secrets.GH_APP_LIBS_PR_MANAGER_ID }}
28+
private-key: ${{ secrets.GH_APP_LIBS_PR_MANAGER_PRIVATE_KEY }}
29+
owner: supabase
30+
31+
- name: Dispatch version update
32+
env:
33+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
34+
TARGET_REPO: ${{ secrets.DEPLOY_TARGET_REPO }}
35+
VERSION: ${{ inputs.version }}
36+
SOURCE: ${{ github.event_name == 'workflow_dispatch' && 'manual-dispatch' || 'realtime-release' }}
37+
run: |
38+
gh api "repos/${TARGET_REPO}/dispatches" \
39+
--method POST \
40+
--field event_type=realtime-release \
41+
--field "client_payload[version]=${VERSION}" \
42+
--field "client_payload[source]=${SOURCE}"

.github/workflows/prod_build.yml

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -175,30 +175,13 @@ jobs:
175175
public.ecr.aws/supabase/realtime:v${{ needs.release.outputs.version }}
176176
ghcr.io/supabase/realtime:v${{ needs.release.outputs.version }}
177177
178-
notify-platform:
178+
dispatch-deploy:
179179
needs: [release, merge_manifest]
180-
runs-on: blacksmith-2vcpu-ubuntu-2404
181180
if: needs.release.outputs.published == 'true'
182-
steps:
183-
- name: Generate GitHub App token
184-
id: app-token
185-
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
186-
with:
187-
app-id: ${{ secrets.GH_APP_LIBS_PR_MANAGER_ID }}
188-
private-key: ${{ secrets.GH_APP_LIBS_PR_MANAGER_PRIVATE_KEY }}
189-
owner: supabase
190-
191-
- name: Dispatch platform version update
192-
env:
193-
GH_TOKEN: ${{ steps.app-token.outputs.token }}
194-
PLATFORM_REPO: ${{ secrets.PLATFORM_REPO }}
195-
VERSION: ${{ needs.release.outputs.version }}
196-
run: |
197-
gh api "repos/${PLATFORM_REPO}/dispatches" \
198-
--method POST \
199-
--field event_type=realtime-release \
200-
--field "client_payload[version]=${VERSION}" \
201-
--field "client_payload[source]=realtime-release"
181+
uses: ./.github/workflows/dispatch_deploy.yml
182+
secrets: inherit
183+
with:
184+
version: ${{ needs.release.outputs.version }}
202185

203186
update-branch-name:
204187
needs: [release, docker_x86_release, docker_arm_release, merge_manifest]

0 commit comments

Comments
 (0)