Admin Sample CD #873
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Admin Sample CD | |
| # 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 | |
| env: | |
| SERVER_WEB_ADDRESS: 'https://adminpanel.bitplatform.dev' | |
| SERVER_API_ADDRESS: 'https://adminpanel-api.bitplatform.dev' | |
| APP_SERVICE_NAME: 'bit-adminpanel' | |
| AzureOpenAI__ApiKey: ${{ secrets.AzureOpenAI__ApiKey }} | |
| AzureOpenAI__Endpoint: ${{ secrets.AzureOpenAI__Endpoint }} | |
| AZUREOPENAI__MODEL: ${{ secrets.AZUREOPENAI__MODEL }} | |
| OpenAI__ApiKey: ${{ secrets.OpenAI__ApiKey }} | |
| OpenAI__Endpoint: ${{ secrets.OpenAI__Endpoint }} | |
| OPENAI__MODEL: ${{ secrets.OPENAI__MODEL }} | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build_api_blazor: | |
| name: build api + blazor web | |
| runs-on: windows-2025 | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@v6 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| global-json-file: src/global.json | |
| - name: Create project from Boilerplate | |
| run: | | |
| cd src/Templates/Boilerplate && dotnet build -c Release | |
| dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 | |
| dotnet new install Bit.Boilerplate.0.0.0.nupkg | |
| cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --module Admin --appInsights --apiServerUrl ${{ env.SERVER_API_ADDRESS }} --webAppUrl ${{ env.SERVER_WEB_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --signalR --ads --api Standalone | |
| - name: Use Bit.ResxTranslator | |
| run: | | |
| cd AdminPanel | |
| dotnet tool install --global Bit.ResxTranslator --prerelease | |
| bit-resx-translate | |
| - name: Update core appsettings.json | |
| uses: devops-actions/[email protected] | |
| with: | |
| files: 'AdminPanel/**/appsettings*json' | |
| env: | |
| ServerAddress: ${{ env.SERVER_API_ADDRESS }} | |
| WebAppRender.BlazorMode: 'BlazorWebAssembly' | |
| GoogleRecaptchaSiteKey: ${{ secrets.GOOGLE_RECAPTCHA_SITE_KEY }} | |
| AdsPushVapid.PublicKey: ${{ secrets.ADMINPANEL_PUBLIC_VAPIDKEY }} | |
| ApplicationInsights.ConnectionString: ${{ secrets.APPLICATION_INSIGHTS_CONNECTION_STRING }} | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| - name: Install wasm | |
| run: cd src && dotnet workload install wasm-tools | |
| - name: Configure text embedding | |
| run: | | |
| sed -i 's/IsEmbeddingEnabled = false/IsEmbeddingEnabled = true/' AdminPanel/src/Server/AdminPanel.Server.Api/Data/AppDbContext.cs | |
| - name: Generate CSS/JS files | |
| run: | | |
| dotnet build AdminPanel/src/Client/AdminPanel.Client.Core/AdminPanel.Client.Core.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APP_VERSION}}" --no-restore -c Release | |
| dotnet build AdminPanel/src/Client/AdminPanel.Client.Web/AdminPanel.Client.Web.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APP_VERSION}}" --no-restore -c Release | |
| - name: Publish Server Web | |
| run: dotnet publish AdminPanel/src/Server/AdminPanel.Server.Web/AdminPanel.Server.Web.csproj -c Release -o server-web -p:Version="${{ vars.APP_VERSION}}" | |
| - name: Publish Server API | |
| run: dotnet publish AdminPanel/src/Server/AdminPanel.Server.Api/AdminPanel.Server.Api.csproj -c Release -o server-api -p:Version="${{ vars.APP_VERSION}}" | |
| - name: Upload server web artifact | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: AdminPanelWeb | |
| path: server-web | |
| include-hidden-files: true # Required for wwwroot/.well-known folder | |
| - name: Upload server api artifact | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: AdminPanelApi | |
| path: server-api | |
| include-hidden-files: true # Required for wwwroot/.well-known folder | |
| deploy_blazor_wasm_standalone: | |
| name: build blazor wasm standalone | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@v6 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| global-json-file: src/global.json | |
| - name: Create project from Boilerplate | |
| run: | | |
| cd src/Templates/Boilerplate && dotnet build -c Release | |
| dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 | |
| dotnet new install Bit.Boilerplate.0.0.0.nupkg | |
| cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --module Admin --appInsights --apiServerUrl ${{ env.SERVER_API_ADDRESS }} --webAppUrl ${{ env.SERVER_WEB_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --signalR --ads | |
| - name: Update core appsettings.json | |
| uses: devops-actions/[email protected] | |
| with: | |
| files: 'AdminPanel/**/appsettings*json' | |
| env: | |
| ServerAddress: ${{ env.SERVER_API_ADDRESS }} | |
| GoogleRecaptchaSiteKey: ${{ secrets.GOOGLE_RECAPTCHA_SITE_KEY }} | |
| AdsPushVapid.PublicKey: ${{ secrets.ADMINPANEL_PUBLIC_VAPIDKEY }} | |
| ApplicationInsights.ConnectionString: ${{ secrets.APPLICATION_INSIGHTS_CONNECTION_STRING }} | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| - name: Install wasm | |
| run: cd src && dotnet workload install wasm-tools | |
| - name: Generate CSS/JS files | |
| run: dotnet build AdminPanel/src/Client/AdminPanel.Client.Core/AdminPanel.Client.Core.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APP_VERSION}}" -p:WasmEnableSIMD=true --no-restore -c Release | |
| - name: Publish | |
| run: dotnet publish AdminPanel/src/Client/AdminPanel.Client.Web/AdminPanel.Client.Web.csproj -c Release -o client -p:WasmEnableSIMD=true -p:Version="${{ vars.APP_VERSION}}" | |
| - name: Upload to asw | |
| run: | | |
| npm install -g @azure/static-web-apps-cli | |
| swa deploy --deployment-token ${{ secrets.ADMINPANEL_ASW_TOKEN }} --env production --app-location client/wwwroot | |
| build_blazor_hybrid_windows: | |
| name: build blazor hybrid (windows) | |
| runs-on: windows-2025 | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@v6 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| global-json-file: src\global.json | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| - name: Create project from Boilerplate | |
| run: | | |
| cd src\Templates\Boilerplate && dotnet build -c Release | |
| dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 | |
| dotnet new install Bit.Boilerplate.0.0.0.nupkg | |
| cd ..\..\..\ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --module Admin --sentry --apiServerUrl ${{ env.SERVER_API_ADDRESS }} --webAppUrl ${{ env.SERVER_WEB_ADDRESS }} --filesStorage AzureBlobStorage --captcha reCaptcha --signalR --ads | |
| - name: Use Bit.ResxTranslator | |
| run: | | |
| cd AdminPanel | |
| dotnet tool install --global Bit.ResxTranslator --prerelease | |
| bit-resx-translate | |
| - name: Update core appsettings.json | |
| uses: devops-actions/[email protected] | |
| with: | |
| files: 'AdminPanel\**\appsettings*json' | |
| env: | |
| WebAppUrl: ${{ env.SERVER_WEB_ADDRESS }} | |
| ServerAddress: ${{ env.SERVER_API_ADDRESS }} | |
| Logging.Sentry.Dsn: ${{ secrets.ADMINPANEL_SENTRY_DSN }} | |
| GoogleRecaptchaSiteKey: ${{ secrets.GOOGLE_RECAPTCHA_SITE_KEY }} | |
| WindowsUpdate.FilesUrl: https://windows-adminpanel.bitplatform.dev | |
| - name: Generate CSS/JS files | |
| run: dotnet build AdminPanel\src\Client\AdminPanel.Client.Core\AdminPanel.Client.Core.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APP_VERSION}}" --no-restore -c Release | |
| - name: Publish | |
| run: | | |
| cd AdminPanel\src\Client\AdminPanel.Client.Windows\ | |
| dotnet publish AdminPanel.Client.Windows.csproj -c Release -o .\publish-result -r win-x64 -p:Version="${{ vars.APP_VERSION}}" -p:PublishReadyToRun=true -p:PublishReadyToRunComposite=true --self-contained | |
| dotnet tool restore | |
| dotnet vpk pack -u AdminPanel.Client.Windows -v "${{ vars.APP_VERSION }}" -p .\publish-result -e AdminPanel.Client.Windows.exe -r win-x64 --framework webview2 --icon .\wwwroot\favicon.ico --packTitle 'AdminPanel' | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: WinAdminPanel | |
| path: AdminPanel\src\Client\AdminPanel.Client.Windows\Releases | |
| build_blazor_hybrid_android: | |
| name: build blazor hybrid (android) | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@v6 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| global-json-file: src/global.json | |
| - name: Create project from Boilerplate | |
| run: | | |
| cd src/Templates/Boilerplate && dotnet build -c Release | |
| dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 | |
| dotnet new install Bit.Boilerplate.0.0.0.nupkg | |
| cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --module Admin --sentry --apiServerUrl ${{ env.SERVER_API_ADDRESS }} --webAppUrl ${{ env.SERVER_WEB_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --signalR --ads | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| - name: Extract Android signing key from env | |
| uses: timheuer/[email protected] | |
| with: | |
| fileDir: './AdminPanel/src/Client/AdminPanel.Client.Maui/' | |
| fileName: 'AdminPanel.keystore' | |
| encodedString: ${{ secrets.ANDROID_RELEASE_KEYSTORE_FILE_BASE64 }} | |
| - name: Extract Android signing key from env | |
| uses: timheuer/[email protected] | |
| with: | |
| fileDir: './AdminPanel/src/Client/AdminPanel.Client.Maui/Platforms/Android' | |
| fileName: 'google-services.json' | |
| encodedString: ${{ secrets.ADMINPANEL_GOOGLE_SERVICES_JSON_BASE64 }} | |
| - name: Use Bit.ResxTranslator | |
| run: | | |
| cd AdminPanel | |
| dotnet tool install --global Bit.ResxTranslator --prerelease | |
| bit-resx-translate | |
| - name: Update core appsettings.json | |
| uses: devops-actions/[email protected] | |
| with: | |
| files: 'AdminPanel/**/appsettings*json' | |
| env: | |
| WebAppUrl: ${{ env.SERVER_WEB_ADDRESS }} | |
| ServerAddress: ${{ env.SERVER_API_ADDRESS }} | |
| Logging.Sentry.Dsn: ${{ secrets.ADMINPANEL_SENTRY_DSN }} | |
| GoogleRecaptchaSiteKey: ${{ secrets.GOOGLE_RECAPTCHA_SITE_KEY }} | |
| - 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 AdminPanel/src/Client/AdminPanel.Client.Core/AdminPanel.Client.Core.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APP_VERSION}}" --no-restore -c Release | |
| dotnet build AdminPanel/src/Client/AdminPanel.Client.Maui/AdminPanel.Client.Maui.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APP_VERSION}}" --no-restore -c Release | |
| - name: Publish aab | |
| run: dotnet publish AdminPanel/src/Client/AdminPanel.Client.Maui/AdminPanel.Client.Maui.csproj -c Release -p:EnableLLVM=true -p:AndroidEnableProfiledAot=false -p:AndroidPackageFormat=aab -p:AndroidKeyStore=true -p:AndroidSigningKeyStore="AdminPanel.keystore" -p:AndroidSigningKeyAlias=bitplatform -p:AndroidSigningKeyPass="${{ secrets.ANDROID_RELEASE_KEYSTORE_PASSWORD }}" -p:AndroidSigningStorePass="${{ secrets.ANDROID_RELEASE_SIGNING_PASSWORD }}" -p:Version="${{ vars.APP_VERSION }}" -p:ApplicationTitle="AdminPanel" -p:ApplicationId="com.bitplatform.AdminPanel.Template" -f net10.0-android | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: android-bundle | |
| path: AdminPanel/src/Client/AdminPanel.Client.Maui/bin/Release/net10.0-android/*-Signed.* | |
| build_blazor_hybrid_ios: | |
| name: build blazor hybrid (iOS-macOS) | |
| runs-on: macOS-26 | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@v6 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| global-json-file: src/global.json | |
| - uses: maxim-lobanov/[email protected] | |
| with: | |
| xcode-version: '26.1' | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| - name: Create project from Boilerplate | |
| run: | | |
| cd src/Templates/Boilerplate && dotnet build -c Release | |
| dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 | |
| dotnet new install Bit.Boilerplate.0.0.0.nupkg | |
| cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --module Admin --sentry --apiServerUrl ${{ env.SERVER_API_ADDRESS }} --webAppUrl ${{ env.SERVER_WEB_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --signalR --ads | |
| - name: Use Bit.ResxTranslator | |
| run: | | |
| cd AdminPanel | |
| dotnet tool install --global Bit.ResxTranslator --prerelease | |
| bit-resx-translate | |
| - name: Update core appsettings.json | |
| uses: devops-actions/[email protected] | |
| with: | |
| files: 'AdminPanel/**/appsettings*json' | |
| env: | |
| WebAppUrl: ${{ env.SERVER_WEB_ADDRESS }} | |
| ServerAddress: ${{ env.SERVER_API_ADDRESS }} | |
| Logging.Sentry.Dsn: ${{ secrets.ADMINPANEL_SENTRY_DSN }} | |
| GoogleRecaptchaSiteKey: ${{ secrets.GOOGLE_RECAPTCHA_SITE_KEY }} | |
| - 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: 'com.bitplatform.AdminPanel.Template' | |
| 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 AdminPanel/src/Client/AdminPanel.Client.Core/AdminPanel.Client.Core.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APP_VERSION}}" --no-restore -c Release | |
| dotnet build AdminPanel/src/Client/AdminPanel.Client.Maui/AdminPanel.Client.Maui.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APP_VERSION}}" --no-restore -c Release | |
| - name: Build ipa | |
| run: dotnet publish AdminPanel/src/Client/AdminPanel.Client.Maui/AdminPanel.Client.Maui.csproj -p:RuntimeIdentifier=ios-arm64 -c Release -p:ArchiveOnBuild=true -p:CodesignKey="iPhone Distribution" -p:CodesignProvision="AdminPanel" -p:Version="${{ vars.APP_VERSION }}" -p:ApplicationTitle="AdminPanel" -p:ApplicationId="com.bitplatform.AdminPanel.Template" -f net10.0-ios | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: ios-bundle | |
| path: AdminPanel/src/Client/AdminPanel.Client.Maui/bin/release/net10.0-ios/ios-arm64/publish/*.ipa |