Merge pull request #47 from VAR-Virtual-Air-Rescue/staging
CD Deployment
This commit was merged in pull request #47.
This commit is contained in:
49
.github/workflows/deploy-production.yml
vendored
Normal file
49
.github/workflows/deploy-production.yml
vendored
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
name: Deploy to Production
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [closed]
|
||||||
|
branches:
|
||||||
|
- release
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
if: github.event.pull_request.merged == true && github.event.pull_request.head.ref == 'staging'
|
||||||
|
name: Deploy to Production
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Pull latest code
|
||||||
|
uses: appleboy/ssh-action@v1
|
||||||
|
with:
|
||||||
|
host: ${{ vars.STAGING_HOST }}
|
||||||
|
username: ${{ secrets.SSH_USERNAME }}
|
||||||
|
password: ${{ secrets.SSH_PASSWORD }}
|
||||||
|
port: 22
|
||||||
|
script: |
|
||||||
|
cd ~/docker/var-monorepo
|
||||||
|
git checkout release
|
||||||
|
git pull
|
||||||
|
- name: Deploy migration to Database
|
||||||
|
uses: appleboy/ssh-action@v1
|
||||||
|
with:
|
||||||
|
host: ${{ vars.STAGING_HOST }}
|
||||||
|
username: ${{ secrets.SSH_USERNAME }}
|
||||||
|
password: ${{ secrets.SSH_PASSWORD }}
|
||||||
|
port: 22
|
||||||
|
script: |
|
||||||
|
export NVM_DIR="$HOME/.nvm"
|
||||||
|
source "$NVM_DIR/nvm.sh"
|
||||||
|
cd ~/docker/var-monorepo/packages/database
|
||||||
|
pnpm exec prisma migrate deploy
|
||||||
|
- name: Build and start containers
|
||||||
|
uses: appleboy/ssh-action@v1
|
||||||
|
with:
|
||||||
|
host: ${{ vars.STAGING_HOST }}
|
||||||
|
username: ${{ secrets.SSH_USERNAME }}
|
||||||
|
password: ${{ secrets.SSH_PASSWORD }}
|
||||||
|
port: 22
|
||||||
|
script: |
|
||||||
|
export NVM_DIR="$HOME/.nvm"
|
||||||
|
source "$NVM_DIR/nvm.sh"
|
||||||
|
cd ~/docker/var-monorepo
|
||||||
|
pnpm staging-start
|
||||||
47
.github/workflows/deploy-staging.yml
vendored
Normal file
47
.github/workflows/deploy-staging.yml
vendored
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
name: Deploy to Staging
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- staging
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
name: Deploy to Staging
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Pull latest code
|
||||||
|
uses: appleboy/ssh-action@v1
|
||||||
|
with:
|
||||||
|
host: ${{ vars.STAGING_HOST }}
|
||||||
|
username: ${{ secrets.SSH_USERNAME }}
|
||||||
|
password: ${{ secrets.SSH_PASSWORD }}
|
||||||
|
port: 22
|
||||||
|
script: |
|
||||||
|
cd ~/docker/var-monorepo
|
||||||
|
git checkout staging
|
||||||
|
git pull
|
||||||
|
- name: Deploy migration to Database
|
||||||
|
uses: appleboy/ssh-action@v1
|
||||||
|
with:
|
||||||
|
host: ${{ vars.STAGING_HOST }}
|
||||||
|
username: ${{ secrets.SSH_USERNAME }}
|
||||||
|
password: ${{ secrets.SSH_PASSWORD }}
|
||||||
|
port: 22
|
||||||
|
script: |
|
||||||
|
export NVM_DIR="$HOME/.nvm"
|
||||||
|
source "$NVM_DIR/nvm.sh"
|
||||||
|
cd ~/docker/var-monorepo/packages/database
|
||||||
|
pnpm exec prisma migrate deploy
|
||||||
|
- name: Build and start containers
|
||||||
|
uses: appleboy/ssh-action@v1
|
||||||
|
with:
|
||||||
|
host: ${{ vars.STAGING_HOST }}
|
||||||
|
username: ${{ secrets.SSH_USERNAME }}
|
||||||
|
password: ${{ secrets.SSH_PASSWORD }}
|
||||||
|
port: 22
|
||||||
|
script: |
|
||||||
|
export NVM_DIR="$HOME/.nvm"
|
||||||
|
source "$NVM_DIR/nvm.sh"
|
||||||
|
cd ~/docker/var-monorepo
|
||||||
|
pnpm staging-start
|
||||||
Reference in New Issue
Block a user