-
Notifications
You must be signed in to change notification settings - Fork 0
193 lines (158 loc) · 5.57 KB
/
master_ffxvi-clive-bot.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
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Production
on:
push:
branches:
- master
workflow_dispatch:
jobs:
# BUILDS
build-bot:
name: Build Bot
runs-on: ubuntu-latest
env:
botdirectory: ./CliveBot
steps:
- uses: actions/checkout@v4
- name: Set up .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
- name: Build with dotnet
working-directory: ${{ env.botdirectory }}
run: dotnet build --configuration Release
- name: dotnet publish
working-directory: ${{ env.botdirectory }}
run: dotnet publish -c Release
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: clivebot
path: ./bin/Release/net8.0/
build-backend-web:
name: Build Backend Web
runs-on: ubuntu-latest
env:
webdirectory: ./Web
steps:
- uses: actions/checkout@v4
- name: Set up .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
- name: Build with dotnet
working-directory: ${{ env.webdirectory }}
run: dotnet build --configuration Release
- name: dotnet publish
working-directory: ${{ env.webdirectory }}
run: dotnet publish -c Release
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: web-backend
path: ./bin/Release/net8.0/
test-build-frontend-web:
name: Test Build Frontend Web
runs-on: ubuntu-latest
environment: Production (Web)
env:
webdirectory: ./Web/Client
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- name: Package Install
working-directory: ${{env.webdirectory}}
run: bun install
- name: Build Web Project
working-directory: ${{env.webdirectory}}
run: bun run build
- name: Test Project
working-directory: ${{env.webdirectory}}
run: bun run test --if-present
# MIGRATIONS
migrations:
name: Database Migrations
runs-on: ubuntu-latest
needs: [build-bot, build-backend-web, test-build-frontend-web]
env:
dbdirectory: ./Database
steps:
- uses: actions/checkout@v4
- name: Set up .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
- name: Set up .NET EF Core Tools
run: dotnet tool install --global dotnet-ef
- name: Run Migrations
working-directory: ${{ env.dbdirectory }}
env:
DATABASE_CONNECTION_URL: ${{ secrets.DATABASE_CONNECTION_URL }}
run: dotnet ef database update
# DEPLOYMENT
deploy-bot:
name: Deploy Bot
runs-on: ubuntu-latest
needs: [migrations, build-bot]
environment:
name: 'Production (Bot)'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v2
with:
name: clivebot
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'FFXVI-Clive-Bot'
slot-name: 'Production'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_6B7928DA4B7E4D72942283AFBF82D918 }}
package: .
deploy-web-backend:
name: Deploy Web Backend
runs-on: ubuntu-latest
needs: [migrations, build-backend-web]
environment:
name: 'Production (Web)'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v2
with:
name: web-backend
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'FFXVI-Clive-Bot-Web'
slot-name: 'Production'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_963A587B3B4944D7B3B56A788FCE27C1 }}
package: .
deploy-web-frontend:
name: Deploy Web Frontend
runs-on: ubuntu-latest
needs: [migrations, test-build-frontend-web]
environment:
name: 'Production (Web)'
url: ${{ steps.builddeploy.outputs.static_web_app_url }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
lfs: false
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_YELLOW_GRASS_0D78F5703 }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: "upload"
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "Web/Client" # App source code path
api_location: "Web/Client/lib/api/functions/" # Api source code path - optional
output_location: "" # Built app content directory - optional
###### End of Repository/Build Configurations ######