Skip to content

Deploy Staging

Deploy Staging #96

Workflow file for this run

name: Deploy Staging
on: workflow_dispatch
jobs:
frontend-quality:
name: Test front end quality
uses: ./.github/workflows/quality-frontend.yml
secrets: inherit
backend-quality:
name: Test Back End Quality
uses: ./.github/workflows/quality-backend.yml
secrets: inherit
email-templates-quality:
name: Test Email Templates Quality
uses: ./.github/workflows/quality-email-templates.yml
secrets: inherit
frontend-build:
name: Build front end
needs: frontend-quality
uses: ./.github/workflows/build-frontend.yml
with:
target-directory: "nantralPlatform-staging"
secrets: inherit
email-templates-build:
name: Build email templates
needs: email-templates-quality
uses: ./.github/workflows/build-email-templates.yml
with:
target-directory: "nantralPlatform-staging"
secrets: inherit
clone-database:
name: Make a copy of the database
runs-on: ubuntu-latest
steps:
- name: Clone the prod database to staging database
uses: appleboy/[email protected]
with:
host: ${{ secrets.INSTANCE_ADDRESS }}
username: "ubuntu"
key: ${{ secrets.SSH_KEY_DEPLOY }}
script: |
set -e
cd nantralPlatform/deployment/scripts
chmod +x db_staging.sh
./db_staging.sh
deploy:
name: Deploy to staging
needs: [frontend-build, email-templates-build, backend-quality, clone-database]
runs-on: ubuntu-latest
steps:
- name: Deploy to the VPS
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.INSTANCE_ADDRESS }}
username: "ubuntu"
key: ${{ secrets.SSH_KEY_DEPLOY }}
script: |
set -e
cd nantralPlatform-staging
git fetch origin ${{ github.ref_name }}
git switch ${{ github.ref_name }}
git reset --hard origin/${{ github.ref_name }}
cd ../nantralPlatform/deployment
sudo docker-compose -f docker-compose.yml -f docker-compose.prod.yml build backend-staging
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d