Skip to content

Commit

Permalink
add github action to publish packages and backend apps
Browse files Browse the repository at this point in the history
  • Loading branch information
TBonnin committed Jan 8, 2024
1 parent 725fcab commit e8687ca
Show file tree
Hide file tree
Showing 17 changed files with 287 additions and 55 deletions.
29 changes: 0 additions & 29 deletions .github/workflows/deploy-runners.yaml

This file was deleted.

79 changes: 79 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Nango Deploy

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

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-ci1oqkm4dad20aa0cd9g" }')[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: Push tag
run: |
docker buildx imagetools create nangohq/nango-jobs:${{ github.sha }} --tag nangohq/nango-jobs:${{ inputs.stage }}
- name: Deploy jobs
run: |
SERVICE_ID=${{ fromJson('{ production: "srv-clvvtdug1b2c73cklps0", staging: "srv-clthttda73kc73ejflg0" }')[inputs.stage] }}
curl --request POST "https://api.render.com/v1/services/$SERVICE_ID/deploys" --header "authorization: Bearer ${{ secrets.RENDER_API_KEY }}"
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
34 changes: 34 additions & 0 deletions .github/workflows/push-container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Push container

on:
workflow_call:
inputs:
package:
required: true
type: string
run-cmd:
required: true
type: string
tags:
required: true
type: string

jobs:
push-container:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x'
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push container
run: |
npm run i
npm run ${{ inputs.run-cmd }}
docker buildx build -f packages/${{ inputs.package }}/Dockerfile --platform linux/amd64 ${{ inputs.tags }} . --no-cache --output type=registry
72 changes: 72 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Nango Release
on: [push, pull_request]
concurrency:
group: pulls/${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
npm-publish:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_PAT }}
- uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- name: Publish npm packages
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
shell: bash
run: |
bash ./scripts/publish.sh
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Update npm packages version
file_pattern: '*.json'
nango-jobs:
uses: ./.github/workflows/push-container.yaml
secrets: inherit
with:
package: jobs
run-cmd: ts-build
tags: -t nangohq/nango-jobs:${{ github.sha }}
nango-runner:
uses: ./.github/workflows/push-container.yaml
secrets: inherit
with:
package: runner
run-cmd: ts-build
tags: -t nangohq/nango-runner:${{ github.sha }}
nango-server-staging:
uses: ./.github/workflows/push-container.yaml
secrets: inherit
with:
package: server
run-cmd: build:staging
tags: -t nangohq/nango-server:staging-${{ github.sha }}
nango-server-prod:
if: github.ref == 'refs/heads/master'
uses: ./.github/workflows/push-container.yaml
secrets: inherit
with:
package: server
run-cmd: build:prod
tags: -t nangohq/nango-server:production-${{ github.sha }}
nango-server-self-hosted:
if: github.ref == 'refs/heads/master'
uses: ./.github/workflows/push-container.yaml
secrets: inherit
with:
package: server
run-cmd: build:hosted
tags: -t nangohq/nango-server:hosted -t nangohq/nango-server:hosted-${{ github.sha }}
nango-server-enterprise:
if: github.ref == 'refs/heads/master'
uses: ./.github/workflows/push-container.yaml
secrets: inherit
with:
package: server
run-cmd: build:enterprise
tags: -t nangohq/nango-server:enterprise -t nangohq/nango-server:enterprise-${{ github.sha }}
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.36.74
23 changes: 20 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/cli/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
- nango

nango-server:
image: nangohq/nango-server:0.36.77
image: nangohq/nango-server
container_name: nango-server
environment:
- TEMPORAL_ADDRESS=temporal:7233
Expand Down
Loading

0 comments on commit e8687ca

Please sign in to comment.