Skip to content

[Release] [staging] Deploy server #1833

[Release] [staging] Deploy server

[Release] [staging] Deploy server #1833

Workflow file for this run

name: '[Release] Deploy service'
run-name: '[Release] [${{ inputs.stage }}] Deploy ${{ inputs.service }}'
on:
workflow_dispatch:
inputs:
stage:
type: choice
description: 'stage to deploy to, defaults to staging'
required: true
default: 'staging'
options:
- staging
- production
service:
type: choice
description: 'Service to deploy, defaults to server'
required: true
default: 'server'
options:
- server
- jobs
- runner
- persist
- orchestrator
- connect_ui
jobs:
deploy_server:
if: inputs.service == 'server'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push tag
run: |
docker buildx imagetools create nangohq/nango-server:${{ inputs.stage }}-${{ github.sha }} --tag nangohq/nango-server:${{ inputs.stage }}
- name: Deploy server
run: |
SERVICE_ID=${{ fromJson('{ production: "srv-cfifsvha6gdq1k7u46a0", staging: "srv-cmj6t6da73kc739ol660" }')[inputs.stage] }}
curl --request POST "https://api.render.com/v1/services/$SERVICE_ID/deploys" \
--header "authorization: Bearer ${{ secrets.RENDER_API_KEY }}"
deploy_jobs:
if: inputs.service == 'jobs'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Deploy jobs
run: |
SERVICE_ID=${{ fromJson('{ production: "srv-clvvtdug1b2c73cklps0", staging: "srv-clthttda73kc73ejflg0" }')[inputs.stage] }}
IMAGE_TAG_PREFIX=${{ fromJson('{ "production": "prod", "staging": "staging" }')[inputs.stage] }}
IMAGE="docker.io/nangohq/nango:${IMAGE_TAG_PREFIX}-${{ github.sha }}"
echo "Deploying $IMAGE to $SERVICE_ID"
curl -sS --fail-with-body --request POST "https://api.render.com/v1/services/$SERVICE_ID/deploys" \
--header "authorization: Bearer ${{ secrets.RENDER_API_KEY }}"\
--data "{ \"imageUrl\": \"$IMAGE\" }"
deploy_runners:
if: inputs.service == 'runner'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push tag
run: |
docker buildx imagetools create nangohq/nango-runner:${{ github.sha }} --tag nangohq/nango-runner:${{ inputs.stage }}
- name: Deploy all runners
env:
API_KEY: ${{ secrets.RENDER_API_KEY }}
ENVIRONMENT: ${{ inputs.stage }}
RUNNER_OWNER_ID: ${{ secrets.RENDER_RUNNER_OWNER_ID }}
run: |
bash ./scripts/deploy/runners.bash
deploy_persist:
if: inputs.service == 'persist'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Deploy persist
run: |
SERVICE_ID=${{ fromJson('{ "production": "srv-cmt150ol6cac73apstq0", "staging": "srv-cmsfiqqcn0vc73bhcod0" }')[inputs.stage] }}
IMAGE_TAG_PREFIX=${{ fromJson('{ "production": "prod", "staging": "staging" }')[inputs.stage] }}
IMAGE="docker.io/nangohq/nango:${IMAGE_TAG_PREFIX}-${{ github.sha }}"
echo "Deploying $IMAGE to $SERVICE_ID"
curl -sS --fail-with-body --request POST "https://api.render.com/v1/services/$SERVICE_ID/deploys" \
--header "authorization: Bearer ${{ secrets.RENDER_API_KEY }}"\
--data "{ \"imageUrl\": \"$IMAGE\" }"
deploy_orchestrator:
if: inputs.service == 'orchestrator'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Deploy orchestrator
run: |
SERVICE_ID=${{ fromJson('{ "production": "srv-cp6bhl0l6cac738i3dm0", "staging": "srv-cp5qedsf7o1s739kjqtg" }')[inputs.stage] }}
IMAGE_TAG_PREFIX=${{ fromJson('{ "production": "prod", "staging": "staging" }')[inputs.stage] }}
IMAGE="docker.io/nangohq/nango:${IMAGE_TAG_PREFIX}-${{ github.sha }}"
echo "Deploying $IMAGE to $SERVICE_ID"
curl -sS --fail-with-body --request POST "https://api.render.com/v1/services/$SERVICE_ID/deploys" \
--header "authorization: Bearer ${{ secrets.RENDER_API_KEY }}"\
--data "{ \"imageUrl\": \"$IMAGE\" }"
deploy_connect_ui:
if: inputs.service == 'connect_ui'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Deploy connect
run: |
SERVICE_ID=${{ fromJson('{ "production": "srv-crtut51u0jms73bts8fg", "staging": "srv-crv6gi68ii6s738m8u90" }')[inputs.stage] }}
COMMIT="${{ github.sha }}"
echo "Deploying $COMMIT to $SERVICE_ID"
curl -sS --fail-with-body --request POST "https://api.render.com/v1/services/$SERVICE_ID/deploys" \
--header "authorization: Bearer ${{ secrets.RENDER_API_KEY }}"\
--data "{ \"commitId\": \"$COMMIT\" }"