Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions .github/workflows/frontend-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches: [develop]
paths:
- 'frontend/**'
pull_request:
branches: [develop]
paths:
- 'frontend/**'
workflow_dispatch:

env:
Expand All @@ -14,9 +18,35 @@ env:
AZURE_RESOURCE_GROUP: rg-dfx-api-dev

jobs:
build-and-deploy:
name: Build and deploy Frontend to DEV
build:
name: Build and test Frontend
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json

- name: Install dependencies
run: npm ci
working-directory: frontend

- name: Build frontend
run: npm run build
working-directory: frontend
env:
VITE_API_BASE_URL: https://dev.monitoring.deuro.com/api

deploy:
name: Deploy Frontend to DEV
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
34 changes: 32 additions & 2 deletions .github/workflows/frontend-prd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches: [main]
paths:
- 'frontend/**'
pull_request:
branches: [main]
paths:
- 'frontend/**'
workflow_dispatch:

env:
Expand All @@ -14,9 +18,35 @@ env:
AZURE_RESOURCE_GROUP: rg-dfx-api-prd

jobs:
build-and-deploy:
name: Build and deploy Frontend to PRD
build:
name: Build and test Frontend
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json

- name: Install dependencies
run: npm ci
working-directory: frontend

- name: Build frontend
run: npm run build
working-directory: frontend
env:
VITE_API_BASE_URL: https://monitoring.deuro.com/api

deploy:
name: Deploy Frontend to PRD
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
50 changes: 41 additions & 9 deletions .github/workflows/monitoring-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches: [develop]
paths-ignore:
- 'frontend/**'
pull_request:
branches: [develop]
paths-ignore:
- 'frontend/**'
workflow_dispatch:
inputs:
reset_database:
Expand All @@ -20,9 +24,29 @@ env:
DEPLOY_INFO: ${{ github.ref_name }}-${{ github.sha }}

jobs:
build-and-deploy:
name: Build and deploy to DEV
build:
name: Build and test Monitoring
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: .
push: false
load: true
tags: ${{ env.DOCKER_TAGS }}

deploy:
name: Deploy Monitoring to DEV
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -54,8 +78,20 @@ jobs:
inlineScript: |
az containerapp update --resource-group ${{ env.AZURE_RESOURCE_GROUP }} --name ${{ env.AZURE_CONTAINER_APP }} --image ${{ env.DOCKER_TAGS }} --set-env-vars DEPLOY_INFO=${{ env.DEPLOY_INFO }}

- name: Reset Database (if requested)
if: inputs.reset_database == true
- name: Logout from Azure
run: az logout
if: always()

reset-database:
name: Reset Database
runs-on: ubuntu-latest
needs: deploy
if: github.event_name == 'workflow_dispatch' && inputs.reset_database == true
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Reset Database
run: |
set -euo pipefail
sudo apt-get update && sudo apt-get install -y postgresql-client
Expand All @@ -68,8 +104,4 @@ jobs:
psql "$DATABASE_URL" -f database/schema.sql
echo "Database reset complete"
env:
DATABASE_URL: ${{ secrets.DATABASE_URL_DEV }}

- name: Logout from Azure
run: az logout
if: always()
DATABASE_URL: ${{ secrets.DATABASE_URL_DEV }}
32 changes: 28 additions & 4 deletions .github/workflows/monitoring-prd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches: [main]
paths-ignore:
- 'frontend/**'
pull_request:
branches: [main]
paths-ignore:
- 'frontend/**'
workflow_dispatch:
inputs:
reset_database:
Expand All @@ -20,9 +24,29 @@ env:
DEPLOY_INFO: ${{ github.ref_name }}-${{ github.sha }}

jobs:
build-and-deploy:
name: Build and deploy to PRD
build:
name: Build and test Monitoring
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: .
push: false
load: true
tags: ${{ env.DOCKER_TAGS }}

deploy:
name: Deploy Monitoring to PRD
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -60,10 +84,10 @@ jobs:

reset-db:
name: Reset PRD Database
needs: build-and-deploy
needs: deploy
runs-on: ubuntu-latest
timeout-minutes: 15
if: inputs.reset_database == true
if: github.event_name == 'workflow_dispatch' && inputs.reset_database == true
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down