Skip to content

Commit

Permalink
test conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
Administrator committed Oct 24, 2024
1 parent a504815 commit f7593da
Showing 1 changed file with 80 additions and 75 deletions.
155 changes: 80 additions & 75 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
name: Build and deploy all of ReportVision's services to a development environment

on:
workflow_dispatch:
inputs:
deploy-env:
description: 'The environment to deploy to'
required: true
type: choice
options:
- dev
- dev2
- dev3
- dev4
- dev5
- dev6
ocr-version:
description: 'Create a version for this OCR API image'
required: true
push:
branches: deploy-both-ocr-api-frontend
# workflow_dispatch:
# inputs:
# deploy-env:
# description: 'The environment to deploy to'
# required: true
# type: choice
# options:
# - dev
# - dev2
# - dev3
# - dev4
# - dev5
# - dev6
# ocr-version:
# description: 'Create a version for this OCR API image'
# required: true

permissions:
contents: read
Expand All @@ -25,74 +27,77 @@ permissions:
id-token: write

jobs:
build-publish-ocr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build and Push backend
uses: ./.github/actions/build-publish-api
with:
docker-registry: ghcr.io
docker-pw: ${{ secrets.GITHUB_TOKEN }}
docker-username: ${{ github.actor }}
docker-tag: ${{ inputs.ocr-version }}
dockerfile-path: ./OCR/Dockerfile
docker-context-path: ./OCR/
api-name: ocr-api
# build-publish-ocr:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Build and Push backend
# uses: ./.github/actions/build-publish-api
# with:
# docker-registry: ghcr.io
# docker-pw: ${{ secrets.GITHUB_TOKEN }}
# docker-username: ${{ github.actor }}
# docker-tag: ${{ inputs.ocr-version }}
# dockerfile-path: ./OCR/Dockerfile
# docker-context-path: ./OCR/
# api-name: ocr-api

build-frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build-frontend
name: Build frontend
with:
api-endpoint: https://reportvision-ocr-${{ inputs.deploy-env }}.azurewebsites.net/
frontend-tarball: ./frontend.tgz
frontend-path: ./frontend
frontend-build-path: ./frontend/dist/
node-version: 20
# build-frontend:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: ./.github/actions/build-frontend
# name: Build frontend
# with:
# api-endpoint: https://reportvision-ocr-${{ inputs.deploy-env }}.azurewebsites.net/
# frontend-tarball: ./frontend.tgz
# frontend-path: ./frontend
# frontend-build-path: ./frontend/dist/
# node-version: 20

environment-setup:
runs-on: ubuntu-latest
environment: ${{ inputs.deploy-env }}
steps:
- uses: actions/checkout@v4
- uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- uses: ./.github/actions/tf-setup
name: Setup this environment with Terraform
with:
deploy-env: ${{ inputs.deploy-env }}
azure-resource-group: reportvision-rg-${{ inputs.deploy-env }}
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
app-name: reportvision
# environment-setup:
# runs-on: ubuntu-latest
# environment: ${{ inputs.deploy-env }}
# steps:
# - uses: actions/checkout@v4
# - uses: azure/login@v2
# with:
# client-id: ${{ secrets.AZURE_CLIENT_ID }}
# tenant-id: ${{ secrets.AZURE_TENANT_ID }}
# subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
# - uses: ./.github/actions/tf-setup
# name: Setup this environment with Terraform
# with:
# deploy-env: ${{ inputs.deploy-env }}
# azure-resource-group: reportvision-rg-${{ inputs.deploy-env }}
# azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
# azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
# azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
# app-name: reportvision

deploy-services:
runs-on: ubuntu-latest
environment: ${{ inputs.deploy-env }}
needs: [build-publish-ocr, build-frontend, environment-setup]
# environment: ${{ inputs.deploy-env }}
# needs: [build-publish-ocr, build-frontend, environment-setup]
steps:
- uses: actions/checkout@v4
- uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Deploy frontend
uses: ./.github/actions/deploy-frontend
with:
frontend-tarball: frontend.tgz
deploy-env: ${{ inputs.deploy-env }}
# - uses: azure/login@v2
# with:
# client-id: ${{ secrets.AZURE_CLIENT_ID }}
# tenant-id: ${{ secrets.AZURE_TENANT_ID }}
# subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
# - name: Deploy frontend
# uses: ./.github/actions/deploy-frontend
# with:
# frontend-tarball: frontend.tgz
# deploy-env: ${{ inputs.deploy-env }}
- name: Deploy OCR-API
env:
ENV: "demo"
if: ${{ env.ENV }} != 'demo'
uses: ./.github/actions/deploy-api
with:
deploy-env: ${{ inputs.deploy-env }}
docker-tag: ${{ inputs.ocr-version }}
deploy-env: ${{ env.ENV }}
docker-tag: test
docker-registry: ghcr.io
api-name: ocr-api

0 comments on commit f7593da

Please sign in to comment.