forked from matijagrcic/azurechatgpt
-
Notifications
You must be signed in to change notification settings - Fork 0
199 lines (181 loc) · 6.25 KB
/
open-ai-app.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
name: Build & deploy Next.js app to Azure Web App
# When this action will be executed
on:
# Automatically trigger it when detected changes in repo
push:
paths-ignore:
- '.github/**'
branches: [main]
# Allow manual workflow trigger
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 🌱 Checkout to the branch
uses: actions/checkout@v3
- name: 🍏 Set up Node.js version
uses: actions/setup-node@v3
with:
node-version: "18.x"
- name: ⚙️ npm install and build
run: |
cd ./src
npm install
npm run build --if-present
cd ..
- name: 📂 Copy standalone into the root
run: cp -R ./src/.next/standalone ./site-deploy
- name: 📂 Copy static into the .next folder
run: cp -R ./src/.next/static ./site-deploy/.next/static
- name: 📂 Copy Public folder
run: cp -R ./src/public ./site-deploy/public
- name: 📦 Package Next application
run: |
cd ./site-deploy
zip Nextjs-site.zip ./* .next -qr
- name: 🔍 Diagnostics
run: |
ls ./src
ls ./src/.next
ls ./site-deploy
- name: ⬆️ Publish Next Application artifact
uses: actions/upload-artifact@v3
with:
name: Nextjs-site
path: ./site-deploy/Nextjs-site.zip
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: "Production"
steps:
- name: ⬇️ Download artifact from build job
uses: actions/download-artifact@v3
with:
name: Nextjs-site
- name: 🗝️ Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: 🚀 Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: ${{ vars.AZURE_APP_SERVICE_NAME }}
package: ${{ github.workspace }}/Nextjs-site.zip
- name: 🛠️ Configures Azure Web App settings
id: configure-webapp
uses: azure/appservice-settings@v1
with:
app-name: ${{ vars.AZURE_APP_SERVICE_NAME }}
app-settings-json: |
[
{
"name": "AZURE_AD_CLIENT_ID",
"value": "${{ vars.AZURE_AD_CLIENT_ID }}",
"slotSetting": false
},
{
"name": "AZURE_AD_TENANT_ID",
"value": "${{ vars.AZURE_AD_TENANT_ID }}",
"slotSetting": false
},
{
"name": "AZURE_APP_SERVICE_NAME",
"value": "${{ vars.AZURE_APP_SERVICE_NAME }}",
"slotSetting": false
},
{
"name": "AZURE_COSMOSDB_URI",
"value": "${{ vars.AZURE_COSMOSDB_URI }}",
"slotSetting": false
},
{
"name": "AZURE_OPENAI_API_DEPLOYMENT_NAME",
"value": "${{ vars.AZURE_OPENAI_API_DEPLOYMENT_NAME }}",
"slotSetting": false
},
{
"name": "AZURE_OPENAI_API_INSTANCE_NAME",
"value": "${{ vars.AZURE_OPENAI_API_INSTANCE_NAME }}",
"slotSetting": false
},
{
"name": "AZURE_OPENAI_API_VERSION",
"value": "${{ vars.AZURE_OPENAI_API_VERSION }}",
"slotSetting": false
},
{
"name": "NEXTAUTH_URL",
"value": "${{ vars.NEXTAUTH_URL }}",
"slotSetting": false
},
{
"name": "AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME",
"value": "${{ vars.AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME }}",
"slotSetting": false
},
{
"name": "AZURE_SEARCH_NAME",
"value": "${{ vars.AZURE_SEARCH_NAME }}",
"slotSetting": false
},
{
"name": "AZURE_SEARCH_INDEX_NAME",
"value": "${{ vars.AZURE_SEARCH_INDEX_NAME }}",
"slotSetting": false
},
{
"name": "AZURE_SEARCH_API_VERSION",
"value": "${{ vars.AZURE_SEARCH_API_VERSION }}",
"slotSetting": false
},
{
"name": "AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT",
"value": "${{ vars.AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT }}",
"slotSetting": false
},
{
"name": "AZURE_OPENAI_API_KEY",
"value": "${{ secrets.AZURE_OPENAI_API_KEY }}",
"slotSetting": false
},
{
"name": "AZURE_AD_CLIENT_SECRET",
"value": "${{ secrets.AZURE_AD_CLIENT_SECRET }}",
"slotSetting": false
},
{
"name": "NEXTAUTH_SECRET",
"value": "${{ secrets.NEXTAUTH_SECRET }}",
"slotSetting": false
},
{
"name": "AZURE_COSMOSDB_KEY",
"value": "${{ secrets.AZURE_COSMOSDB_KEY }}",
"slotSetting": false
},
{
"name": "AZURE_SEARCH_API_KEY",
"value": "${{ secrets.AZURE_SEARCH_API_KEY }}",
"slotSetting": false
},
{
"name": "AZURE_DOCUMENT_INTELLIGENCE_KEY",
"value": "${{ secrets.AZURE_DOCUMENT_INTELLIGENCE_KEY }}",
"slotSetting": false
},
{
"name": "AZURE_COSMOSDB_DB_NAME",
"value": "${{ vars.AZURE_COSMOSDB_DB_NAME }}",
"slotSetting": false
},
{
"name": "AZURE_COSMOSDB_CONTAINER_NAME",
"value": "${{ vars.AZURE_COSMOSDB_CONTAINER_NAME }}",
"slotSetting": false
}
]
- name: 🧹 Cleanup
run: rm ${{ github.workspace }}/Nextjs-site.zip