1+ name : Build and Deploy Template
2+
3+ on :
4+ workflow_call :
5+ inputs :
6+ ENV_NAME :
7+ required : true
8+ type : string
9+
10+ permissions :
11+ contents : read
12+
13+ jobs :
14+
15+ build_api_blazor :
16+ name : build api + blazor web
17+ runs-on : ubuntu-24.04
18+ environment : ${{ inputs.ENV_NAME }}
19+ steps :
20+
21+ - name : Checkout source code
22+ uses : actions/checkout@v4
23+
24+ - name : Setup .NET
25+ uses : actions/setup-dotnet@v4
26+ with :
27+ global-json-file : global.json
28+
29+ - uses : actions/setup-node@v4
30+ with :
31+ node-version : 23
32+
33+ - name : Use Bit.ResxTranslator
34+ run : |
35+ dotnet tool install --global Bit.ResxTranslator
36+ bit-resx-translate
37+
38+ - name : Update core appsettings.json
39+ uses : devops-actions/variable-substitution@v1.2
40+ with :
41+ files : ' src/**/appsettings*json'
42+ env :
43+ WebAppRender.BlazorMode : ' BlazorWebAssembly'
44+ ServerAddress : ${{ vars.SERVER_ADDRESS }}
45+ # if (notifications == true)
46+ AdsPushVapid.PublicKey : ${{ secrets.PUBLIC_VAPIDKEY }}
47+ # endif
48+
49+ - name : Install wasm
50+ run : cd src && dotnet workload install wasm-tools
51+
52+ - name : Generate CSS/JS files
53+ run : |
54+ dotnet build src/Client/Boilerplate.Client.Core/Boilerplate.Client.Core.csproj -t:BeforeBuildTasks --no-restore -c Release -p:Version="${{ vars.APP_VERSION }}"
55+ dotnet build src/Client/Boilerplate.Client.Web/Boilerplate.Client.Web.csproj -t:BeforeBuildTasks --no-restore -c Release -p:Version="${{ vars.APP_VERSION }}"
56+
57+ - name : Publish
58+ run : dotnet publish src/Server/Boilerplate.Server.Web/Boilerplate.Server.Web.csproj -c Release --self-contained -r linux-x64 -o ${{env.DOTNET_ROOT}}/server -p:Version="${{ vars.APP_VERSION }}" -p:Environment=${{ inputs.ENV_NAME }}
59+ - name : Upload server artifact
60+ uses : actions/upload-artifact@v4
61+ with :
62+ name : server-bundle
63+ path : ${{env.DOTNET_ROOT}}/server
64+ include-hidden-files : true # Required for wwwroot/.well-known folder
65+
66+ deploy_api_blazor :
67+ name : deploy api + blazor
68+ needs : build_api_blazor
69+ runs-on : ubuntu-24.04
70+ environment :
71+ name : ${{ inputs.ENV_NAME }}
72+ url : ${{ steps.deploy-to-webapp.outputs.webapp-url }}
73+
74+ steps :
75+
76+ - name : Retrieve server bundle
77+ uses : actions/download-artifact@v4
78+ with :
79+ name : server-bundle
80+
81+ - name : Deploy to Azure Web App
82+ id : deploy-to-webapp
83+ uses : azure/webapps-deploy@v3
84+ with :
85+ app-name : ${{ vars.APP_SERVICE_NAME }}
86+ slot-name : ' production'
87+ publish-profile : ${{ secrets.AZURE_PUBLISH_PROFILE }}
88+ package : .
89+
90+ # if (cloudflare == true)
91+ - name : Purge Cloudflare cache
92+ uses : jakejarvis/cloudflare-purge-action@v0.3.0
93+ env :
94+ CLOUDFLARE_ZONE : ${{ secrets.CLOUDFLARE_ZONE }}
95+ CLOUDFLARE_TOKEN : ${{ secrets.CLOUDFLARE_TOKEN }}
96+ # endif
97+
98+ build_blazor_hybrid_windows :
99+ name : build blazor hybrid (windows)
100+ runs-on : windows-2022
101+ environment : ${{ inputs.ENV_NAME }}
102+ steps :
103+
104+ - name : Checkout source code
105+ uses : actions/checkout@v4
106+
107+ - name : Setup .NET
108+ uses : actions/setup-dotnet@v4
109+ with :
110+ global-json-file : global.json
111+
112+ - uses : actions/setup-node@v4
113+ with :
114+ node-version : 23
115+
116+ - name : Use Bit.ResxTranslator
117+ run : |
118+ dotnet tool install --global Bit.ResxTranslator
119+ bit-resx-translate
120+
121+ - name : Update core appsettings.json
122+ uses : devops-actions/variable-substitution@v1.2
123+ with :
124+ files : ' src\**\appsettings*json'
125+ env :
126+ ServerAddress : ${{ vars.SERVER_ADDRESS }}
127+ WindowsUpdate.FilesUrl : ${{ vars.WINDOWS_UPDATE_FILES_URL }}
128+
129+ - name : Generate CSS/JS files
130+ run : dotnet build src\Client\Boilerplate.Client.Core\Boilerplate.Client.Core.csproj -t:BeforeBuildTasks --no-restore -c Release -p:Version="${{ vars.APP_VERSION }}"
131+
132+ - name : Publish
133+ run : |
134+ cd src\Client\Boilerplate.Client.Windows\
135+ dotnet publish Boilerplate.Client.Windows.csproj -c Release -o .\publish-result -r win-x86 -p:Version="${{ vars.APP_VERSION }}" --self-contained -p:Environment=${{ inputs.ENV_NAME }}
136+ dotnet tool restore
137+ dotnet vpk pack -u ${{ vars.APP_ID }} -v "${{ vars.APP_VERSION }}" -p .\publish-result -e Boilerplate.Client.Windows.exe -r win-x86 --framework webview2 --icon .\wwwroot\favicon.ico --packTitle '${{ vars.APP_TITLE }}'
138+
139+ - name : Upload artifact
140+ uses : actions/upload-artifact@v4
141+ with :
142+ name : win-exe-bundle
143+ path : src\Client\Boilerplate.Client.Windows\Releases
144+
145+ build_blazor_hybrid_android :
146+ name : build blazor hybrid (android)
147+ runs-on : ubuntu-24.04
148+ environment : ${{ inputs.ENV_NAME }}
149+
150+ steps :
151+ - name : Checkout source code
152+ uses : actions/checkout@v4
153+
154+ - name : Setup .NET
155+ uses : actions/setup-dotnet@v4
156+ with :
157+ global-json-file : global.json
158+
159+ - uses : actions/setup-node@v4
160+ with :
161+ node-version : 23
162+
163+ - name : Extract Android signing key
164+ uses : timheuer/base64-to-file@v1.2
165+ with :
166+ fileDir : ' ./src/Client/Boilerplate.Client.Maui/'
167+ fileName : ' Boilerplate.keystore'
168+ encodedString : ${{ secrets.ANDROID_RELEASE_KEYSTORE_FILE_BASE64 }}
169+
170+ - name : Use Bit.ResxTranslator
171+ run : |
172+ dotnet tool install --global Bit.ResxTranslator
173+ bit-resx-translate
174+
175+ - name : Update core appsettings.json
176+ uses : devops-actions/variable-substitution@v1.2
177+ with :
178+ files : ' src/**/appsettings*json'
179+ env :
180+ ServerAddress : ${{ vars.SERVER_ADDRESS }}
181+
182+ - name : Install maui
183+ run : cd src && dotnet workload install maui-android
184+
185+ - name : Install Android Sdk platform tools
186+ run : ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --sdk_root=$ANDROID_SDK_ROOT "platform-tools"
187+
188+ - name : Generate CSS/JS files
189+ run : |
190+ dotnet build src/Client/Boilerplate.Client.Core/Boilerplate.Client.Core.csproj -t:BeforeBuildTasks --no-restore -c Release -p:Version="${{ vars.APP_VERSION }}"
191+ dotnet build src/Client/Boilerplate.Client.Maui/Boilerplate.Client.Maui.csproj -t:BeforeBuildTasks --no-restore -c Release -p:Version="${{ vars.APP_VERSION }}"
192+
193+ - name : Publish aab
194+ run : dotnet publish src/Client/Boilerplate.Client.Maui/Boilerplate.Client.Maui.csproj -c Release -p:ApplicationId=${{ vars.APP_ID }} -p:AndroidPackageFormat=aab -p:AndroidKeyStore=true -p:AndroidSigningKeyStore="Boilerplate.keystore" -p:AndroidSigningKeyAlias=Boilerplate -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 net9.0-android
195+
196+ - name : Upload artifact
197+ uses : actions/upload-artifact@v4
198+ with :
199+ name : android-bundle
200+ path : src/Client/Boilerplate.Client.Maui/bin/Release/net9.0-android/*-Signed.*
201+
202+ build_blazor_hybrid_iOS :
203+ name : build blazor hybrid (iOS-macOS)
204+ runs-on : macOS-15
205+ environment : ${{ inputs.ENV_NAME }}
206+
207+ steps :
208+
209+ - name : Checkout source code
210+ uses : actions/checkout@v4
211+
212+ - name : Setup .NET
213+ uses : actions/setup-dotnet@v4
214+ with :
215+ global-json-file : global.json
216+
217+ - uses : maxim-lobanov/setup-xcode@v1.6.0
218+ with :
219+ xcode-version : ' 16.4'
220+
221+ - uses : actions/setup-node@v4
222+ with :
223+ node-version : 23
224+
225+ - name : Use Bit.ResxTranslator
226+ run : |
227+ dotnet tool install --global Bit.ResxTranslator
228+ bit-resx-translate
229+
230+ - name : Update core appsettings.json
231+ uses : devops-actions/variable-substitution@v1.2
232+ with :
233+ files : ' src/**/appsettings*json'
234+ env :
235+ ServerAddress : ${{ vars.SERVER_ADDRESS }}
236+
237+ - name : Install maui
238+ run : cd src && dotnet workload install maui
239+
240+ - name : Import Code-Signing Certificates
241+ uses : apple-actions/import-codesign-certs@v5
242+ with :
243+ p12-file-base64 : ${{ secrets.APPSTORE_CODE_SIGNING_CERTIFICATE_FILE_BASE64 }}
244+ p12-password : ${{ secrets.APPSTORE_CODE_SIGNING_CERTIFICATE_FILE_PASSWORD }}
245+
246+ - name : Download Apple Provisioning Profiles
247+ uses : Apple-Actions/download-provisioning-profiles@v4
248+ with :
249+ bundle-id : ${{ vars.APP_ID }}
250+ issuer-id : ${{ secrets.APPSTORE_API_KEY_ISSUER_ID }}
251+ api-key-id : ${{ secrets.APPSTORE_API_KEY_ID }}
252+ api-private-key : ${{ secrets.APPSTORE_API_KEY_PRIVATE_KEY }}
253+
254+ - name : Generate CSS/JS files
255+ run : |
256+ dotnet build src/Client/Boilerplate.Client.Core/Boilerplate.Client.Core.csproj -t:BeforeBuildTasks --no-restore -c Release -p:Version="${{ vars.APP_VERSION }}"
257+ dotnet build src/Client/Boilerplate.Client.Maui/Boilerplate.Client.Maui.csproj -t:BeforeBuildTasks --no-restore -c Release -p:Version="${{ vars.APP_VERSION }}"
258+
259+ - name : Build ipa
260+ run : dotnet publish src/Client/Boilerplate.Client.Maui/Boilerplate.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 net9.0-ios
261+
262+ - name : Upload artifact
263+ uses : actions/upload-artifact@v4
264+ with :
265+ name : iOS-bundle
266+ path : src/Client/Boilerplate.Client.Maui/bin/release/net9.0-ios/ios-arm64/publish/*.ipa
0 commit comments