Skip to content

Commit a79d3f6

Browse files
author
Administrator
committed
test with sha with middleware
1 parent 190a9b3 commit a79d3f6

File tree

1 file changed

+135
-126
lines changed

1 file changed

+135
-126
lines changed

.github/workflows/deploy-dev.yml

+135-126
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
name: Build and deploy all of ReportVision's services to a development environment
22

33
on:
4-
workflow_dispatch:
5-
inputs:
6-
deploy-env:
7-
description: 'The environment to deploy to'
8-
required: true
9-
type: choice
10-
options:
11-
- dev
12-
- demo
13-
ocr-docker-tag:
14-
description: 'This is optional if you would like to deploy an already published OCR-API image'
15-
required: false
16-
ocr-version:
17-
description: 'Create a version for this OCR API image'
18-
required: true
19-
middleware-version:
20-
description: 'Create a version for this middleware API image'
21-
required: true
4+
push:
5+
branches: use-sha-instead-of-version
6+
# workflow_dispatch:
7+
# inputs:
8+
# deploy-env:
9+
# description: 'The environment to deploy to'
10+
# required: true
11+
# type: choice
12+
# options:
13+
# - dev
14+
# - demo
15+
# ocr-docker-tag:
16+
# description: 'This is optional if you would like to deploy an already published OCR-API image'
17+
# required: false
18+
# middleware-docker-tag:
19+
# description: 'This is optional if you would like to deploy an already published Middleware-API image'
20+
# required: false
2221

2322
permissions:
2423
contents: read
@@ -30,45 +29,18 @@ jobs:
3029
build-publish-middleware:
3130
name: Build and Publish middleware
3231
runs-on: ubuntu-latest
33-
outputs:
34-
docker_inspect: ${{ steps.image_check.outputs.docker_inspect }}
35-
steps:
36-
- uses: actions/checkout@v4
37-
- name: Lowercase the repo name
38-
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
39-
- name: Check if image exists
40-
id: image_check
41-
run: |
42-
echo "docker_inspect=$(
43-
docker manifest inspect ghcr.io/${{ env.REPO }}-middleware-api:${{ inputs.middleware-version }} > /dev/null ; echo $?
44-
)" >> $GITHUB_OUTPUT
45-
- name: Build and Push the middleware
46-
if: ${{ steps.image_check.outputs.docker_inspect == 1 }}
47-
uses: ./.github/actions/build-publish-api
48-
with:
49-
docker-registry: ghcr.io
50-
docker-pw: ${{ secrets.GITHUB_TOKEN }}
51-
docker-username: ${{ github.actor }}
52-
docker-tag: ${{ inputs.middleware-version }}
53-
dockerfile-path: ./backend/Dockerfile
54-
docker-context-path: ./backend/
55-
api-name: middleware-api
56-
57-
build-publish-ocr:
58-
name: Build and Publish OCR
59-
runs-on: ubuntu-latest
6032
outputs:
6133
docker_inspect: ${{ steps.image_check.outputs.docker_inspect }}
6234
docker_tag: ${{ steps.set_tag.outputs.docker_tag }}
6335
steps:
6436
- uses: actions/checkout@v4
6537
- name: Lowercase the repo name
6638
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
67-
- name: Set OCR Docker tag
39+
- name: Set Middleware Docker tag
6840
shell: bash
6941
id: set_tag
7042
run: |
71-
USER_INPUT="${{ github.event.inputs.ocr-docker-tag }}"
43+
USER_INPUT=""
7244
echo "docker_tag=$(
7345
#this gives a new sha as default if dispatch input is empty
7446
echo ${USER_INPUT:-"${{ github.sha }}"}
@@ -77,60 +49,97 @@ jobs:
7749
id: image_check
7850
run: |
7951
echo "docker_inspect=$(
80-
docker manifest inspect ghcr.io/${{ env.REPO }}-ocr-api:${{ steps.set_tag.outputs.docker_tag }} > /dev/null ; echo $?
52+
docker manifest inspect ghcr.io/${{ env.REPO }}-middleware-api:${{ steps.set_tag.outputs.docker_tag }} > /dev/null ; echo $?
8153
)" >> $GITHUB_OUTPUT
82-
- name: Build and Push the OCR
54+
- name: Build and Push the middleware
8355
if: ${{ steps.image_check.outputs.docker_inspect == 1 }}
8456
uses: ./.github/actions/build-publish-api
8557
with:
8658
docker-registry: ghcr.io
8759
docker-pw: ${{ secrets.GITHUB_TOKEN }}
8860
docker-username: ${{ github.actor }}
8961
docker-tag: ${{ steps.set_tag.outputs.docker_tag }}
90-
dockerfile-path: ./OCR/Dockerfile
91-
docker-context-path: ./OCR/
92-
api-name: ocr-api
62+
dockerfile-path: ./backend/Dockerfile
63+
docker-context-path: ./backend/
64+
api-name: middleware-api
9365

94-
build-frontend:
95-
name: Build Frontend
96-
runs-on: ubuntu-latest
97-
steps:
98-
- uses: actions/checkout@v4
99-
- uses: ./.github/actions/build-frontend
100-
name: Build frontend
101-
with:
102-
api-endpoint: https://reportvision-ocr-${{ inputs.deploy-env }}.azurewebsites.net/
103-
frontend-tarball: ./frontend.tgz
104-
frontend-path: ./frontend
105-
frontend-build-path: ./frontend/dist/
106-
node-version: 20
66+
# build-publish-ocr:
67+
# name: Build and Publish OCR
68+
# runs-on: ubuntu-latest
69+
# outputs:
70+
# docker_inspect: ${{ steps.image_check.outputs.docker_inspect }}
71+
# docker_tag: ${{ steps.set_tag.outputs.docker_tag }}
72+
# steps:
73+
# - uses: actions/checkout@v4
74+
# - name: Lowercase the repo name
75+
# run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
76+
# - name: Set OCR Docker tag
77+
# shell: bash
78+
# id: set_tag
79+
# run: |
80+
# USER_INPUT="${{ github.event.inputs.ocr-docker-tag }}"
81+
# echo "docker_tag=$(
82+
# #this gives a new sha as default if dispatch input is empty
83+
# echo ${USER_INPUT:-"${{ github.sha }}"}
84+
# )" >> $GITHUB_OUTPUT
85+
# - name: Check if image exists
86+
# id: image_check
87+
# run: |
88+
# echo "docker_inspect=$(
89+
# docker manifest inspect ghcr.io/${{ env.REPO }}-ocr-api:${{ steps.set_tag.outputs.docker_tag }} > /dev/null ; echo $?
90+
# )" >> $GITHUB_OUTPUT
91+
# - name: Build and Push the OCR
92+
# if: ${{ steps.image_check.outputs.docker_inspect == 1 }}
93+
# uses: ./.github/actions/build-publish-api
94+
# with:
95+
# docker-registry: ghcr.io
96+
# docker-pw: ${{ secrets.GITHUB_TOKEN }}
97+
# docker-username: ${{ github.actor }}
98+
# docker-tag: ${{ steps.set_tag.outputs.docker_tag }}
99+
# dockerfile-path: ./OCR/Dockerfile
100+
# docker-context-path: ./OCR/
101+
# api-name: ocr-api
107102

108-
az-environment-setup:
109-
name: Setup Azure Environment
110-
runs-on: ubuntu-latest
111-
environment: ${{ inputs.deploy-env }}
112-
steps:
113-
- uses: actions/checkout@v4
114-
- uses: azure/login@v2
115-
with:
116-
client-id: ${{ secrets.AZURE_CLIENT_ID }}
117-
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
118-
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
119-
- uses: ./.github/actions/tf-setup
120-
name: Setup this environment with Terraform
121-
with:
122-
deploy-env: ${{ inputs.deploy-env }}
123-
azure-resource-group: reportvision-rg-${{ inputs.deploy-env }}
124-
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
125-
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
126-
azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
127-
app-name: reportvision
103+
# build-frontend:
104+
# name: Build Frontend
105+
# runs-on: ubuntu-latest
106+
# steps:
107+
# - uses: actions/checkout@v4
108+
# - uses: ./.github/actions/build-frontend
109+
# name: Build frontend
110+
# with:
111+
# api-endpoint: https://reportvision-ocr-${{ inputs.deploy-env }}.azurewebsites.net/
112+
# frontend-tarball: ./frontend.tgz
113+
# frontend-path: ./frontend
114+
# frontend-build-path: ./frontend/dist/
115+
# node-version: 20
116+
117+
# az-environment-setup:
118+
# name: Setup Azure Environment
119+
# runs-on: ubuntu-latest
120+
# environment: ${{ inputs.deploy-env }}
121+
# steps:
122+
# - uses: actions/checkout@v4
123+
# - uses: azure/login@v2
124+
# with:
125+
# client-id: ${{ secrets.AZURE_CLIENT_ID }}
126+
# tenant-id: ${{ secrets.AZURE_TENANT_ID }}
127+
# subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
128+
# - uses: ./.github/actions/tf-setup
129+
# name: Setup this environment with Terraform
130+
# with:
131+
# deploy-env: ${{ inputs.deploy-env }}
132+
# azure-resource-group: reportvision-rg-${{ inputs.deploy-env }}
133+
# azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
134+
# azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
135+
# azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
136+
# app-name: reportvision
128137

129138
deploy-middleware:
130139
name: Deploy middleware
131140
runs-on: ubuntu-latest
132-
environment: ${{ inputs.deploy-env }}
133-
needs: [build-publish-middleware, az-environment-setup]
141+
environment: dev
142+
needs: [build-publish-middleware]
134143
steps:
135144
- uses: actions/checkout@v4
136145
- uses: azure/login@v2
@@ -141,46 +150,46 @@ jobs:
141150
- name: Deploy middleware-API
142151
uses: ./.github/actions/deploy-api
143152
with:
144-
deploy-env: ${{ inputs.deploy-env }}
145-
docker-tag: ${{ inputs.middleware-version }}
153+
deploy-env: dev
154+
docker-tag: ${{ needs.build-publish-middleware.outputs.docker_tag }}
146155
docker-registry: ghcr.io
147156
api-name: middleware-api
148157

149-
deploy-ocr:
150-
name: Deploy OCR
151-
runs-on: ubuntu-latest
152-
environment: ${{ inputs.deploy-env }}
153-
needs: [build-publish-ocr, az-environment-setup]
154-
steps:
155-
- uses: actions/checkout@v4
156-
- uses: azure/login@v2
157-
with:
158-
client-id: ${{ secrets.AZURE_CLIENT_ID }}
159-
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
160-
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
161-
- name: Deploy OCR-API
162-
uses: ./.github/actions/deploy-api
163-
with:
164-
deploy-env: ${{ inputs.deploy-env }}
165-
docker-tag: ${{ needs.build-publish-ocr.outputs.docker_tag }}
166-
docker-registry: ghcr.io
167-
api-name: ocr-api
158+
# deploy-ocr:
159+
# name: Deploy OCR
160+
# runs-on: ubuntu-latest
161+
# environment: ${{ inputs.deploy-env }}
162+
# needs: [build-publish-ocr, az-environment-setup]
163+
# steps:
164+
# - uses: actions/checkout@v4
165+
# - uses: azure/login@v2
166+
# with:
167+
# client-id: ${{ secrets.AZURE_CLIENT_ID }}
168+
# tenant-id: ${{ secrets.AZURE_TENANT_ID }}
169+
# subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
170+
# - name: Deploy OCR-API
171+
# uses: ./.github/actions/deploy-api
172+
# with:
173+
# deploy-env: ${{ inputs.deploy-env }}
174+
# docker-tag: ${{ needs.build-publish-ocr.outputs.docker_tag }}
175+
# docker-registry: ghcr.io
176+
# api-name: ocr-api
168177

169-
deploy-frontend:
170-
name: Deploy Frontend
171-
runs-on: ubuntu-latest
172-
environment: ${{ inputs.deploy-env }}
173-
needs: [build-frontend, az-environment-setup]
174-
if: ${{ inputs.deploy-env != 'demo'}}
175-
steps:
176-
- uses: actions/checkout@v4
177-
- uses: azure/login@v2
178-
with:
179-
client-id: ${{ secrets.AZURE_CLIENT_ID }}
180-
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
181-
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
182-
- name: Deploy frontend
183-
uses: ./.github/actions/deploy-frontend
184-
with:
185-
frontend-tarball: frontend.tgz
186-
deploy-env: ${{ inputs.deploy-env }}
178+
# deploy-frontend:
179+
# name: Deploy Frontend
180+
# runs-on: ubuntu-latest
181+
# environment: ${{ inputs.deploy-env }}
182+
# needs: [build-frontend, az-environment-setup]
183+
# if: ${{ inputs.deploy-env != 'demo'}}
184+
# steps:
185+
# - uses: actions/checkout@v4
186+
# - uses: azure/login@v2
187+
# with:
188+
# client-id: ${{ secrets.AZURE_CLIENT_ID }}
189+
# tenant-id: ${{ secrets.AZURE_TENANT_ID }}
190+
# subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
191+
# - name: Deploy frontend
192+
# uses: ./.github/actions/deploy-frontend
193+
# with:
194+
# frontend-tarball: frontend.tgz
195+
# deploy-env: ${{ inputs.deploy-env }}

0 commit comments

Comments
 (0)