@@ -3,7 +3,8 @@ name: Todo Sample CD
33# Project templates come equipped with CI/CD for both Azure DevOps and GitHub, providing you with a hassle-free way to get started with your new project. It is important to note that you should not depend on the contents of this file. More info at https://bitplatform.dev/templates/dev-ops
44
55env :
6- SERVER_ADDRESS : ' https://todo.bitplatform.dev'
6+ SERVER_WEB_ADDRESS : ' https://todo.bitplatform.dev'
7+ SERVER_API_ADDRESS : ' https://todo-api.bitplatform.dev'
78 AzureOpenAI__ApiKey : ${{ secrets.AzureOpenAI__ApiKey }}
89 AzureOpenAI__Endpoint : ${{ secrets.AzureOpenAI__Endpoint }}
910 AZUREOPENAI__MODEL : ${{ secrets.AZUREOPENAI__MODEL }}
@@ -19,15 +20,15 @@ permissions:
1920
2021jobs :
2122
22- build_api_blazor :
23- name : build api + blazor web
23+ build_api :
24+ name : build api
2425 runs-on : windows-2025
2526
2627 steps :
2728
2829 - name : Checkout source code
2930 uses : actions/checkout@v6
30-
31+
3132 - name : Setup .NET
3233 uses : actions/setup-dotnet@v5
3334 with :
@@ -39,11 +40,62 @@ jobs:
3940
4041 - name : Create project from Boilerplate
4142 run : |
42- cd src/Templates/Boilerplate && dotnet build -c Release
43- dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
44- dotnet new install Bit.Boilerplate.0.0.0.nupkg
45- cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample --appInsights --apiServerUrl ${{ env.SERVER_ADDRESS }} --webAppUrl ${{ env.SERVER_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --signalR --ads
43+ cd src/Templates/Boilerplate && dotnet build -c Release
44+ dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
45+ dotnet new install Bit.Boilerplate.0.0.0.nupkg
46+ cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample --appInsights --apiServerUrl ${{ env.SERVER_API_ADDRESS }} --webAppUrl ${{ env.SERVER_WEB_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --offlineDb --signalR --ads --api Standalone
47+
48+ - name : Use Bit.ResxTranslator
49+ run : |
50+ cd TodoSample
51+ dotnet tool install --global Bit.ResxTranslator --prerelease
52+ bit-resx-translate
4653
54+ - name : Update core appsettings.json
55+ uses : devops-actions/variable-substitution@v1.2
56+ with :
57+ files : ' TodoSample/**/appsettings*json'
58+ env :
59+ ServerAddress : ${{ env.SERVER_API_ADDRESS }}
60+ AdsPushVapid.PublicKey : ${{ secrets.TODO_PUBLIC_VAPIDKEY }}
61+ GoogleRecaptchaSiteKey : ${{ secrets.GOOGLE_RECAPTCHA_SITE_KEY }}
62+ ApplicationInsights.ConnectionString : ${{ secrets.APPLICATION_INSIGHTS_CONNECTION_STRING }}
63+
64+ - name : Publish Server API
65+ run : dotnet publish TodoSample/src/Server/TodoSample.Server.Api/TodoSample.Server.Api.csproj -c Release -o server-api -p:Version="${{ vars.APP_VERSION}}"
66+
67+ - name : Upload server api artifact
68+ uses : actions/upload-artifact@v5
69+ with :
70+ name : server-api-bundle
71+ path : server-api
72+ include-hidden-files : true # Required for wwwroot/.well-known folder
73+
74+ build_blazor :
75+ name : build blazor web
76+ runs-on : windows-2025
77+
78+ steps :
79+
80+ - name : Checkout source code
81+ uses : actions/checkout@v6
82+
83+ - name : Setup .NET
84+ uses : actions/setup-dotnet@v5
85+ with :
86+ global-json-file : src/global.json
87+
88+ - uses : actions/setup-node@v6
89+ with :
90+ node-version : 24
91+
92+ - name : Create project from Boilerplate
93+ run : |
94+ cd src/Templates/Boilerplate && dotnet build -c Release
95+ dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
96+ dotnet new install Bit.Boilerplate.0.0.0.nupkg
97+ cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample --appInsights --apiServerUrl ${{ env.SERVER_API_ADDRESS }} --webAppUrl ${{ env.SERVER_WEB_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --signalR --ads --api Standalone
98+
4799 - name : Use Bit.ResxTranslator
48100 run : |
49101 cd TodoSample
@@ -56,67 +108,34 @@ jobs:
56108 files : ' TodoSample/**/appsettings*json'
57109 env :
58110 WebAppRender.PrerenderEnabled : true
59- ServerAddress : ${{ env.SERVER_ADDRESS }}
111+ ServerAddress : ${{ env.SERVER_API_ADDRESS }}
60112 WebAppRender.BlazorMode : ' BlazorWebAssembly'
61113 AdsPushVapid.PublicKey : ${{ secrets.TODO_PUBLIC_VAPIDKEY }}
62114 GoogleRecaptchaSiteKey : ${{ secrets.GOOGLE_RECAPTCHA_SITE_KEY }}
63115 ApplicationInsights.ConnectionString : ${{ secrets.APPLICATION_INSIGHTS_CONNECTION_STRING }}
64-
116+
65117 - name : Install wasm
66118 run : cd src && dotnet workload install wasm-tools
67119
68120 - name : Configure bswup # Always AlwaysPrerender is the last item, so overriding it has the desired effect
69121 run : |
70122 sed -i "s/\/\/ self.mode = 'AlwaysPrerender'/self.mode = 'InitialPrerender'/g" TodoSample/src/Client/TodoSample.Client.Web/wwwroot/service-worker.published.js
71-
123+
72124 - name : Generate CSS/JS files
73125 run : |
74126 dotnet build TodoSample/src/Client/TodoSample.Client.Core/TodoSample.Client.Core.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APP_VERSION}}" --no-restore -c Release
75127 dotnet build TodoSample/src/Client/TodoSample.Client.Web/TodoSample.Client.Web.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APP_VERSION}}" --no-restore -c Release
128+
129+ - name : Publish Server Web
130+ run : dotnet publish TodoSample/src/Server/TodoSample.Server.Web/TodoSample.Server.Web.csproj -c Release -o server-web -p:Version="${{ vars.APP_VERSION}}"
76131
77- - name : Publish
78- run : dotnet publish TodoSample/src/Server/TodoSample.Server.Web/TodoSample.Server.Web.csproj -c Release -o server -p:Version="${{ vars.APP_VERSION}}"
79-
80- - name : Upload server artifact
132+ - name : Upload server web artifact
81133 uses : actions/upload-artifact@v5
82134 with :
83- name : server-bundle
84- path : server
135+ name : server-web- bundle
136+ path : server-web
85137 include-hidden-files : true # Required for wwwroot/.well-known folder
86138
87- deploy_api_blazor :
88- name : deploy api + blazor
89- needs : build_api_blazor
90- runs-on : ubuntu-24.04
91- environment :
92- name : ' production'
93- url : ${{ steps.deploy-to-webapp.outputs.webapp-url }}
94-
95- steps :
96-
97- - name : Retrieve server bundle
98- uses : actions/download-artifact@v6
99- with :
100- name : server-bundle
101-
102- - name : Retrieve AppleAuthKey.p8
103- run : echo "${{ secrets.APPSTORE_API_KEY_PRIVATE_KEY_TODO }}" > AppleAuthKey.p8
104-
105- - name : Deploy to Azure Web App
106- id : deploy-to-webapp
107- uses : azure/webapps-deploy@v3
108- with :
109- app-name : ' bit-todo'
110- slot-name : ' production'
111- publish-profile : ${{ secrets.TODO_AZURE_APP_SERVICE_PUBLISH_PROFILE }}
112- package : .
113-
114- - name : Purge cache
115- uses : jakejarvis/cloudflare-purge-action@v0.3.0
116- env :
117- CLOUDFLARE_ZONE : ${{ secrets.BITPLATFORM_DEV_CLOUDFLARE_ZONE }}
118- CLOUDFLARE_TOKEN : ${{ secrets.CLOUDFLARE_TOKEN }}
119-
120139 deploy_blazor_wasm_standalone_aot :
121140 name : build blazor wasm standalone (AOT)
122141 runs-on : ubuntu-24.04
0 commit comments