-
Notifications
You must be signed in to change notification settings - Fork 6
265 lines (212 loc) · 9.86 KB
/
cd-template.yml
File metadata and controls
265 lines (212 loc) · 9.86 KB
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
name: Build and Deploy Template
on:
workflow_call:
inputs:
ENV_NAME:
required: true
type: string
env:
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: true
permissions:
contents: read
jobs:
build_api_blazor:
name: build api + blazor web
runs-on: ubuntu-24.04
environment: ${{ inputs.ENV_NAME }}
steps:
- name: Checkout source code
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json
- uses: actions/setup-node@v6
with:
node-version: 24
- name: Use Bit.ResxTranslator
run: |
dotnet tool install --global Bit.ResxTranslator
bit-resx-translate
- name: Update core appsettings.json
uses: devops-actions/variable-substitution@v1.2
with:
files: 'src/**/appsettings*json'
env:
WebAppRender.BlazorMode: 'BlazorWebAssembly'
ServerAddress: ${{ vars.SERVER_ADDRESS }}
AdsPushVapid.PublicKey: ${{ secrets.PUBLIC_VAPIDKEY }}
- name: Install wasm
run: cd src && dotnet workload install wasm-tools
- name: Generate CSS/JS files
run: |
dotnet build src/Client/Bit.TemplatePlayground.Client.Core/Bit.TemplatePlayground.Client.Core.csproj -t:BeforeBuildTasks --no-restore -c Release -p:Version="${{ vars.APP_VERSION }}"
dotnet build src/Client/Bit.TemplatePlayground.Client.Web/Bit.TemplatePlayground.Client.Web.csproj -t:BeforeBuildTasks --no-restore -c Release -p:Version="${{ vars.APP_VERSION }}"
- name: Publish
run: dotnet publish src/Server/Bit.TemplatePlayground.Server.Web/Bit.TemplatePlayground.Server.Web.csproj -c Release --self-contained -r linux-x64 -o server -p:Version="${{ vars.APP_VERSION }}" -p:Environment=${{ inputs.ENV_NAME }}
- name: Upload server artifact
uses: actions/upload-artifact@v5
with:
name: server-bundle
path: server
include-hidden-files: true # Required for wwwroot/.well-known folder
deploy_api_blazor:
name: deploy api + blazor
needs: build_api_blazor
runs-on: ubuntu-24.04
environment:
name: ${{ inputs.ENV_NAME }}
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
steps:
- name: Retrieve server bundle
uses: actions/download-artifact@v6
with:
name: server-bundle
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: ${{ vars.APP_SERVICE_NAME }}
slot-name: 'production'
publish-profile: ${{ secrets.AZURE_PUBLISH_PROFILE }}
package: .
- name: Purge Cloudflare cache
uses: jakejarvis/cloudflare-purge-action@v0.3.0
env:
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }}
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
build_blazor_hybrid_windows:
name: build blazor hybrid (windows)
runs-on: windows-2025
environment: ${{ inputs.ENV_NAME }}
steps:
- name: Checkout source code
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json
- uses: actions/setup-node@v6
with:
node-version: 24
- name: Use Bit.ResxTranslator
run: |
dotnet tool install --global Bit.ResxTranslator
bit-resx-translate
- name: Update core appsettings.json
uses: devops-actions/variable-substitution@v1.2
with:
files: 'src\**\appsettings*json'
env:
ServerAddress: ${{ vars.SERVER_ADDRESS }}
WindowsUpdate.FilesUrl: ${{ vars.WINDOWS_UPDATE_FILES_URL }}
- name: Generate CSS/JS files
run: dotnet build src\Client\Bit.TemplatePlayground.Client.Core\Bit.TemplatePlayground.Client.Core.csproj -t:BeforeBuildTasks --no-restore -c Release -p:Version="${{ vars.APP_VERSION }}"
- name: Publish
run: |
cd src\Client\Bit.TemplatePlayground.Client.Windows\
dotnet publish Bit.TemplatePlayground.Client.Windows.csproj -c Release -o .\publish-result -r win-x86 -p:Version="${{ vars.APP_VERSION }}" --self-contained -p:Environment=${{ inputs.ENV_NAME }}
dotnet tool restore
dotnet vpk pack -u ${{ vars.APP_ID }} -v "${{ vars.APP_VERSION }}" -p .\publish-result -e Bit.TemplatePlayground.Client.Windows.exe -r win-x86 --framework webview2 --icon .\wwwroot\favicon.ico --packTitle '${{ vars.APP_TITLE }}'
- name: Upload artifact
uses: actions/upload-artifact@v5
with:
name: win-exe-bundle
path: src\Client\Bit.TemplatePlayground.Client.Windows\Releases
build_blazor_hybrid_android:
name: build blazor hybrid (android)
runs-on: ubuntu-24.04
environment: ${{ inputs.ENV_NAME }}
steps:
- name: Checkout source code
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json
- uses: actions/setup-node@v6
with:
node-version: 24
- name: Extract Android signing key
uses: timheuer/base64-to-file@v1.2
with:
fileDir: './src/Client/Bit.TemplatePlayground.Client.Maui/'
fileName: 'Bit.TemplatePlayground.keystore'
encodedString: ${{ secrets.ANDROID_RELEASE_KEYSTORE_FILE_BASE64 }}
- name: Use Bit.ResxTranslator
run: |
dotnet tool install --global Bit.ResxTranslator
bit-resx-translate
- name: Update core appsettings.json
uses: devops-actions/variable-substitution@v1.2
with:
files: 'src/**/appsettings*json'
env:
ServerAddress: ${{ vars.SERVER_ADDRESS }}
- name: Install maui
run: cd src && dotnet workload install maui-android
- name: Install Android Sdk platform tools
run: ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --sdk_root=$ANDROID_SDK_ROOT "platform-tools"
- name: Generate CSS/JS files
run: |
dotnet build src/Client/Bit.TemplatePlayground.Client.Core/Bit.TemplatePlayground.Client.Core.csproj -t:BeforeBuildTasks --no-restore -c Release -p:Version="${{ vars.APP_VERSION }}"
dotnet build src/Client/Bit.TemplatePlayground.Client.Maui/Bit.TemplatePlayground.Client.Maui.csproj -t:BeforeBuildTasks --no-restore -c Release -p:Version="${{ vars.APP_VERSION }}"
- name: Publish aab
run: dotnet publish src/Client/Bit.TemplatePlayground.Client.Maui/Bit.TemplatePlayground.Client.Maui.csproj -c Release -p:ApplicationId=${{ vars.APP_ID }} -p:AndroidPackageFormat=aab -p:AndroidKeyStore=true -p:AndroidSigningKeyStore="Bit.TemplatePlayground.keystore" -p:AndroidSigningKeyAlias=Bit.TemplatePlayground -p:AndroidSigningKeyPass="${{ secrets.ANDROID_RELEASE_KEYSTORE_PASSWORD }}" -p:AndroidSigningStorePass="${{ secrets.ANDROID_RELEASE_SIGNING_PASSWORD }}" -p:Version="${{ vars.APP_VERSION }}" -p:Environment=${{ inputs.ENV_NAME }} -f net10.0-android
- name: Upload artifact
uses: actions/upload-artifact@v5
with:
name: android-bundle
path: src/Client/Bit.TemplatePlayground.Client.Maui/bin/Release/net10.0-android/*-Signed.*
build_blazor_hybrid_iOS:
name: build blazor hybrid (iOS-macOS)
runs-on: macOS-26
environment: ${{ inputs.ENV_NAME }}
steps:
- name: Checkout source code
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json
- uses: maxim-lobanov/setup-xcode@v1.6.0
with:
xcode-version: '26.2'
- uses: actions/setup-node@v6
with:
node-version: 24
- name: Use Bit.ResxTranslator
run: |
dotnet tool install --global Bit.ResxTranslator
bit-resx-translate
- name: Update core appsettings.json
uses: devops-actions/variable-substitution@v1.2
with:
files: 'src/**/appsettings*json'
env:
ServerAddress: ${{ vars.SERVER_ADDRESS }}
- name: Install maui
run: cd src && dotnet workload install maui
- name: Import Code-Signing Certificates
uses: apple-actions/import-codesign-certs@v5
with:
p12-file-base64: ${{ secrets.APPSTORE_CODE_SIGNING_CERTIFICATE_FILE_BASE64 }}
p12-password: ${{ secrets.APPSTORE_CODE_SIGNING_CERTIFICATE_FILE_PASSWORD }}
- name: Download Apple Provisioning Profiles
uses: Apple-Actions/download-provisioning-profiles@v4
with:
bundle-id: ${{ vars.APP_ID }}
issuer-id: ${{ secrets.APPSTORE_API_KEY_ISSUER_ID }}
api-key-id: ${{ secrets.APPSTORE_API_KEY_ID }}
api-private-key: ${{ secrets.APPSTORE_API_KEY_PRIVATE_KEY }}
- name: Generate CSS/JS files
run: |
dotnet build src/Client/Bit.TemplatePlayground.Client.Core/Bit.TemplatePlayground.Client.Core.csproj -t:BeforeBuildTasks --no-restore -c Release -p:Version="${{ vars.APP_VERSION }}"
dotnet build src/Client/Bit.TemplatePlayground.Client.Maui/Bit.TemplatePlayground.Client.Maui.csproj -t:BeforeBuildTasks --no-restore -c Release -p:Version="${{ vars.APP_VERSION }}"
- name: Build ipa
run: dotnet publish src/Client/Bit.TemplatePlayground.Client.Maui/Bit.TemplatePlayground.Client.Maui.csproj -p:ApplicationId=${{ vars.APP_ID }} -p:RuntimeIdentifier=ios-arm64 -c Release -p:ArchiveOnBuild=true -p:CodesignKey="iPhone Distribution" -p:CodesignProvision="${{ vars.IOS_CODE_SIGN_PROVISION }}" -p:Version="${{ vars.APP_VERSION }}" -p:Environment=${{ inputs.ENV_NAME }} -f net10.0-ios
- name: Upload artifact
uses: actions/upload-artifact@v5
with:
name: iOS-bundle
path: src/Client/Bit.TemplatePlayground.Client.Maui/bin/release/net10.0-ios/ios-arm64/publish/*.ipa