Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 8 additions & 144 deletions .github/workflows/prod.yml
Original file line number Diff line number Diff line change
@@ -1,154 +1,18 @@
name: MT Deploy Production
name: Deploy Production
on:
push:
branches:
- release

pull_request:
types: [closed]
branches:
- 'releases/latest'

jobs:
release:
runs-on: ubuntu-20.04
outputs:
published: ${{ steps.semantic.outputs.new_release_published }}
version: ${{ steps.semantic.outputs.new_release_version }}
steps:
- uses: actions/checkout@v3
- id: semantic
uses: cycjimmy/semantic-release-action@v3
with:
semantic_version: 18
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_PROJECT_ACTION }}

deploy:
needs: release
if: github.event.pull_request.merged == true
runs-on: ubuntu-20.04
if: needs.release.outputs.published == 'true'
steps:
- uses: actions/checkout@v2
- uses: superfly/flyctl-actions@1.1
with:
args: "-c deploy/fly/prod.toml deploy --build-arg SLOT_NAME_SUFFIX=${GITHUB_SHA::7}"
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

docker_x86_release:
needs: release
runs-on: ubuntu-20.04
if: needs.release.outputs.published == 'true'
timeout-minutes: 120
env:
arch: amd64
outputs:
image_digest: ${{ steps.build.outputs.digest }}
steps:
- id: meta
uses: docker/metadata-action@v4
with:
images: |
supabase/realtime
tags: |
type=raw,value=v${{ needs.release.outputs.version }}_${{ env.arch }}

- uses: docker/setup-buildx-action@v2

- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- id: build
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/${{ env.arch }}
cache-from: type=gha
cache-to: type=gha,mode=max

docker_arm_release:
needs: release
runs-on: arm-runner
if: needs.release.outputs.published == 'true'
timeout-minutes: 120
env:
arch: arm64
outputs:
image_digest: ${{ steps.build.outputs.digest }}
steps:
- uses: actions/checkout@v3

- id: meta
uses: docker/metadata-action@v4
with:
images: |
supabase/realtime
tags: |
type=raw,value=v${{ needs.release.outputs.version }}_${{ env.arch }}

- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- uses: docker/setup-buildx-action@v2
with:
driver: docker
driver-opts: |
image=moby/buildkit:master
network=host

- id: build
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/${{ env.arch }}
no-cache: true

merge_manifest:
needs: [release, docker_x86_release, docker_arm_release]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- uses: docker/setup-buildx-action@v2

- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Merge multi-arch manifests
run: |
docker buildx imagetools create -t supabase/realtime:v${{ needs.release.outputs.version }} \
supabase/realtime@${{ needs.docker_x86_release.outputs.image_digest }} \
supabase/realtime@${{ needs.docker_arm_release.outputs.image_digest }}

- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.PROD_AWS_ROLE }}
aws-region: us-east-1

- name: Login to ECR
uses: docker/login-action@v2
with:
registry: public.ecr.aws

- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Mirror to ECR
uses: akhilerm/tag-push-action@v2.0.0
with:
src: docker.io/supabase/realtime:v${{ needs.release.outputs.version }}
dst: |
public.ecr.aws/supabase/realtime:v${{ needs.release.outputs.version }}
ghcr.io/supabase/realtime:v${{ needs.release.outputs.version }}
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
154 changes: 154 additions & 0 deletions .github/workflows/prod_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
name: Build Production
on:
push:
branches:
- 'main'
jobs:
release:
runs-on: ubuntu-20.04
outputs:
published: ${{ steps.semantic.outputs.new_release_published }}
version: ${{ steps.semantic.outputs.new_release_version }}
steps:
- uses: actions/checkout@v3
- id: semantic
uses: cycjimmy/semantic-release-action@v3
with:
semantic_version: 18
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_PROJECT_ACTION }}

docker_x86_release:
needs: release
runs-on: ubuntu-20.04
if: needs.release.outputs.published == 'true'
timeout-minutes: 120
env:
arch: amd64
outputs:
image_digest: ${{ steps.build.outputs.digest }}
steps:
- id: meta
uses: docker/metadata-action@v4
with:
images: |
supabase/realtime
tags: |
type=raw,value=v${{ needs.release.outputs.version }}_${{ env.arch }}

- uses: docker/setup-buildx-action@v2

- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- id: build
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/${{ env.arch }}
cache-from: type=gha
cache-to: type=gha,mode=max

docker_arm_release:
needs: release
runs-on: arm-runner
if: needs.release.outputs.published == 'true'
timeout-minutes: 120
env:
arch: arm64
outputs:
image_digest: ${{ steps.build.outputs.digest }}
steps:
- uses: actions/checkout@v3

- id: meta
uses: docker/metadata-action@v4
with:
images: |
supabase/realtime
tags: |
type=raw,value=v${{ needs.release.outputs.version }}_${{ env.arch }}

- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- uses: docker/setup-buildx-action@v2
with:
driver: docker
driver-opts: |
image=moby/buildkit:master
network=host

- id: build
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/${{ env.arch }}
no-cache: true

merge_manifest:
needs: [release, docker_x86_release, docker_arm_release]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- uses: docker/setup-buildx-action@v2

- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Merge multi-arch manifests
run: |
docker buildx imagetools create -t supabase/realtime:v${{ needs.release.outputs.version }} \
supabase/realtime@${{ needs.docker_x86_release.outputs.image_digest }} \
supabase/realtime@${{ needs.docker_arm_release.outputs.image_digest }}

- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.PROD_AWS_ROLE }}
aws-region: us-east-1

- name: Login to ECR
uses: docker/login-action@v2
with:
registry: public.ecr.aws

- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Mirror to ECR
uses: akhilerm/tag-push-action@v2.0.0
with:
src: docker.io/supabase/realtime:v${{ needs.release.outputs.version }}
dst: |
public.ecr.aws/supabase/realtime:v${{ needs.release.outputs.version }}
ghcr.io/supabase/realtime:v${{ needs.release.outputs.version }}

update-branch-name:
needs: [release, docker_x86_release, docker_arm_release, merge_manifest]
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v2
with:
ref: refs/heads/main
- name: Update branch name
run: |
git branch -m main releases/v${{ needs.release.outputs.version }}
git push origin HEAD:releases/v${{ needs.release.outputs.version }}
2 changes: 1 addition & 1 deletion .github/workflows/prod_linter.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: MT Production Formatting Checks
name: Production Formatting Checks
on:
pull_request:
branches:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/staging.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: MT Deploy Staging
name: Deploy Staging
on:
push:
branches:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/staging_linter.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: MT Staging Formatting Checks
name: Staging Formatting Checks
on:
pull_request:
branches:
Expand Down Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Run main database migrations
run: mix ecto.migrate --log-migrator-sql
- name: Run database tenant migrations
run: mix ecto.migrate --migrations-path priv/repo/postgres/migrations
run: mix ecto.migrate --migrations-path lib/extensions/postgres_cdc_rls/repo/migrations
- name: Run format check
run: mix format --check-formatted
- name: Credo checks
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/staging_tealbench.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: MT Tealbench
name: Tealbench
on:
push:
branches:
Expand Down Expand Up @@ -28,4 +28,4 @@ jobs:
curl --request POST \
--url https://Tealbench.fly.dev/api/runs \
--header 'Authorization: User ${{ secrets.BENCHMARK_JWT }}' \
--data '{"benchmark_id":"SyMKxU3TOiWcAvU","name":"PR ${{ env.PR_NUM }}","comment": "https://github.com/supabase/realtime/pull/${{ env.PR_NUM }}", "origin":"main"}'
--data '{"benchmark_id":"SyMKxU3TOiWcAvU","name":"PR ${{ env.PR_NUM }}","comment": "https://github.com/Tealbase/realtime/pull/${{ env.PR_NUM }}", "origin":"main"}'
29 changes: 29 additions & 0 deletions .github/workflows/version_updated.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on:
pull_request:
types: [opened, reopened, synchronize]
branches:
- 'main'

name: Default Checks

jobs:
versions_updated:
name: Versions Updated
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Verify Versions Updated
uses: tj-actions/changed-files@v35
id: verify_changed_files
with:
files: |
mix.exs

- name: Fail Unless Versions Updated
id: fail_unless_changed
if: steps.verify_changed_files.outputs.any_changed == 'false'
run: |
echo "::error ::Please update the mix.exs version"
exit 1
Loading
Loading