Skip to content

Deploy Staging

Deploy Staging #8

name: Deploy Staging
on:
workflow_run:
workflows: ["Feature Build"]
types:
- completed
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
EC2-Deploy:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
environment:
name: staging
url: ${{ steps.deploy.outputs.vm_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: staging
- name: Ensure `dist` Folder Exists
run: |
if [ ! -d "public/dist" ]; then
echo "Dist folder not found. Aborting deployment."
exit 1
fi
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Create repo_env file
run: |
echo "CLIENT_COMMIT_SHA=${{ github.sha }}" > repo_env
echo "CLIENT_STATUS_REPORTS_ENV=staging" >> repo_env
echo "CLIENT_FRONTEND_SENTRY_DSN=https://c8f8aad7cbf776a99570cd163a5c86b1@o4508721931616256.ingest.us.sentry.io/4508733956947968" >> repo_env
echo "BACKEND_SENTRY_DSN=https://26de5611d04fde803427885bdb82a7bc@o4508721931616256.ingest.us.sentry.io/4508721935351808" >> repo_env
echo "CLIENT_JIRA_APP_KEY=bitovi.status-report.staging" >> repo_env
echo "repo_env file created with CLIENT_COMMIT_SHA=${{ github.sha }} at $(pwd)"
- name: Create Jira Connect
run: |
npm ci
npm run create:atlassian-connect -- --environment=staging
- name: Cleanup for Deploy
run: rm -rf node_modules
- id: deploy
name: Deploy
uses: bitovi/github-actions-deploy-docker-to-ec2@v1
with:
checkout: false
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID_JIRA_INTEGRATIONS}}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_JIRA_INTEGRATIONS}}
aws_default_region: us-east-1
tf_state_bucket_destroy: true
aws_r53_enable: true
aws_r53_create_sub_cert: true
aws_r53_sub_domain_name: status-reports-staging
aws_r53_domain_name: bitovi.tools
aws_elb_app_port: 3000
docker_full_cleanup: true
aws_ec2_instance_type: t3.small
aws_ec2_instance_root_vol_size: 16
repo_env: repo_env
env_ghs: ${{ secrets.DOT_ENV_MAIN }}
Sentry-Release-Backend:
needs: EC2-Deploy
if: ${{ success() }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_BACKEND_PROJECT }}
with:
environment: staging
version: ${{ github.sha }}
Sentry-Release-Frontend:
needs: EC2-Deploy
if: ${{ success() }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_FRONTEND_PROJECT }}
with:
environment: staging
version: ${{ github.sha }}