Merge pull request #14 from hootanht/main #51
This file contains 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: CrystallineSociety CD | |
# https://bitplatform.dev/todo-template/dev-ops | |
env: | |
WEB_APP_DEPLOYMENT_TYPE: 'DefaultDeploymentType' | |
API_SERVER_ADDRESS: 'https://todo.bitplatform.dev/api/' | |
APP_SERVICE_NAME: 'app-service-td-test' | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
build_blazor_api_wasm: | |
name: build blazor api + web assembly | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
global-json-file: src/CrystallineSociety/global.json | |
- name: Install wasm-tools | |
run: dotnet workload install wasm-tools | |
- name: Switch to blazor web assembly | |
run: sed -i 's/Microsoft.NET.Sdk.Web/Microsoft.NET.Sdk.BlazorWebAssembly/g' src/CrystallineSociety/Client/Web/CrystallineSociety.Client.Web.csproj | |
- name: Restore workloads | |
run: dotnet workload restore src/CrystallineSociety/Client/Web/CrystallineSociety.Client.Web.csproj -p:BlazorMode=BlazorWebAssembly -p:WebAppDeploymentType="${{ env.WEB_APP_DEPLOYMENT_TYPE }}" | |
- name: Build (To generate CSS/JS files) | |
run: dotnet build src/CrystallineSociety/Server/Api/CrystallineSociety.Server.Api.csproj -p:BlazorMode=BlazorWebAssembly -p:WebAppDeploymentType="${{ env.WEB_APP_DEPLOYMENT_TYPE }}" -p:Configuration=Release | |
- name: Publish | |
run: dotnet publish src/CrystallineSociety/Server/Api/CrystallineSociety.Server.Api.csproj -p:BlazorMode=BlazorWebAssembly -p:WebAppDeploymentType="${{ env.WEB_APP_DEPLOYMENT_TYPE }}" -p:Configuration=Release --self-contained -r linux-x64 -o ${{env.DOTNET_ROOT}}/api-web | |
- name: Build migrations bundle | |
run: | | |
dotnet tool install --global dotnet-ef --version 7.0.0 | |
dotnet ef migrations bundle --self-contained -r linux-x64 --project src/CrystallineSociety/Server/Api/CrystallineSociety.Server.Api.csproj | |
- name: Upload ef migrations bundle | |
uses: actions/upload-artifact@v3 | |
with: | |
name: migrations-bundle | |
path: efbundle | |
- name: Upload api-web artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: api-web-bundle | |
path: ${{env.DOTNET_ROOT}}/api-web |