Skip to content

Commit

Permalink
feat(github actions): change cd pipelines to use project created by d…
Browse files Browse the repository at this point in the history
…otnet new #6008 (#6010)
  • Loading branch information
ysmoradi authored Nov 13, 2023
1 parent 052136c commit 3140e03
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 53 deletions.
94 changes: 68 additions & 26 deletions .github/workflows/adminpanel.cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,28 @@ jobs:
with:
global-json-file: src/Templates/AdminPanel/Bit.AdminPanel/global.json

- name: Create project from AdminPanel
run: |
cd src/Templates/AdminPanel && dotnet build -c Release
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.AdminPanel.0.0.0.nupkg
cd ../../../ && dotnet new bit-admin --name AdminPanel --database SqlServer
- uses: actions/setup-node@v3
with:
node-version: 18

- name: Switch to blazor web assembly
run: sed -i 's/Microsoft.NET.Sdk.Web/Microsoft.NET.Sdk.BlazorWebAssembly/g' src/Templates/AdminPanel/Bit.AdminPanel/src/Client/Web/AdminPanel.Client.Web.csproj
run: sed -i 's/Microsoft.NET.Sdk.Web/Microsoft.NET.Sdk.BlazorWebAssembly/g' AdminPanel/src/Client/Web/AdminPanel.Client.Web.csproj

- name: Install wasm
run: cd src && dotnet workload install wasm-tools wasm-experimental

- name: Generate CSS/JS files
run: dotnet build src/Templates/AdminPanel/Bit.AdminPanel/src/Client/Core/AdminPanel.Client.Core.csproj -t:BeforeBuildTasks --no-restore
run: dotnet build AdminPanel/src/Client/Core/AdminPanel.Client.Core.csproj -t:BeforeBuildTasks --no-restore

- name: Publish
run: dotnet publish src/Templates/AdminPanel/Bit.AdminPanel/src/Server/Api/AdminPanel.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
run: dotnet publish AdminPanel/src/Server/Api/AdminPanel.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: Upload api-web artifact
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -101,6 +108,13 @@ jobs:
uses: actions/setup-dotnet@v3
with:
global-json-file: src/Templates/AdminPanel/Bit.AdminPanel/global.json

- name: Create project from AdminPanel
run: |
cd src/Templates/AdminPanel && dotnet build -c Release
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.AdminPanel.0.0.0.nupkg
cd ../../../ && dotnet new bit-admin --name AdminPanel --database SqlServer
- uses: actions/setup-node@v3
with:
Expand All @@ -109,24 +123,24 @@ jobs:
- name: Update appsettings.json api server address
uses: microsoft/variable-substitution@v1
with:
files: 'src/Templates/AdminPanel/Bit.AdminPanel/src/Client/Core/appsettings.json'
files: 'AdminPanel/src/Client/Core/appsettings.json'
env:
ApiServerAddress: ${{ env.API_SERVER_ADDRESS }}

- name: Install maui
run: cd src && dotnet workload install maui

- name: Generate CSS/JS files
run: dotnet build src/Templates/AdminPanel/Bit.AdminPanel/src/Client/Core/AdminPanel.Client.Core.csproj -t:BeforeBuildTasks --no-restore
run: dotnet build AdminPanel/src/Client/Core/AdminPanel.Client.Core.csproj -t:BeforeBuildTasks --no-restore

- name: Build exe
run: dotnet build src/Templates/AdminPanel/Bit.AdminPanel/src/Client/App/AdminPanel.Client.App.csproj -p:BlazorMode=BlazorHybrid -p:Configuration=Release -p:WindowsPackageType=None -p:SelfContained=true -p:WindowsAppSDKSelfContained=true -p:GenerateAppxPackageOnBuild=false -p:RuntimeIdentifier=win10-x86 -p:ApplicationDisplayVersion="${{ vars.APPLICATION_DISPLAY_VERSION }}" -p:ApplicationVersion="${{ vars.APPLICATION_VERSION }}" -p:UseRidGraph=true -f net8.0-windows10.0.19041.0
run: dotnet build AdminPanel/src/Client/App/AdminPanel.Client.App.csproj -p:BlazorMode=BlazorHybrid -p:Configuration=Release -p:WindowsPackageType=None -p:SelfContained=true -p:WindowsAppSDKSelfContained=true -p:GenerateAppxPackageOnBuild=false -p:RuntimeIdentifier=win10-x86 -p:ApplicationDisplayVersion="${{ vars.APPLICATION_DISPLAY_VERSION }}" -p:ApplicationVersion="${{ vars.APPLICATION_VERSION }}" -p:UseRidGraph=true -f net8.0-windows10.0.19041.0

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: win-exe-bundle
path: src/Templates/AdminPanel/Bit.AdminPanel/src/Client/App/bin/release/net8.0-windows10.0.19041.0/win10-x86
path: AdminPanel/src/Client/App/bin/release/net8.0-windows10.0.19041.0/win10-x86

build_blazor_hybrid_android:
name: build blazor hybrid (android)
Expand All @@ -142,38 +156,45 @@ jobs:
with:
global-json-file: src/Templates/AdminPanel/Bit.AdminPanel/global.json

- name: Create project from AdminPanel
run: |
cd src/Templates/AdminPanel && dotnet build -c Release
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.AdminPanel.0.0.0.nupkg
cd ../../../ && dotnet new bit-admin --name AdminPanel --database SqlServer
- uses: actions/setup-node@v3
with:
node-version: 18

- name: Extract Android signing key from env
uses: timheuer/base64-to-file@v1
with:
fileDir: './src/Templates/AdminPanel/Bit.AdminPanel/src/Client/App/'
fileDir: './AdminPanel/src/Client/App/'
fileName: 'AdminPanel.keystore'
encodedString: ${{ secrets.ANDROID_RELEASE_KEYSTORE_FILE_BASE64 }}

- name: Update appsettings.json api server address
uses: microsoft/variable-substitution@v1
with:
files: 'src/Templates/AdminPanel/Bit.AdminPanel/src/Client/Core/appsettings.json'
files: 'AdminPanel/src/Client/Core/appsettings.json'
env:
ApiServerAddress: ${{ env.API_SERVER_ADDRESS }}

- name: Install maui
run: cd src && dotnet workload install maui-android

- name: Generate CSS/JS files
run: dotnet build src/Templates/AdminPanel/Bit.AdminPanel/src/Client/Core/AdminPanel.Client.Core.csproj -t:BeforeBuildTasks --no-restore
run: dotnet build AdminPanel/src/Client/Core/AdminPanel.Client.Core.csproj -t:BeforeBuildTasks --no-restore

- name: Build aab
run: dotnet build src/Templates/AdminPanel/Bit.AdminPanel/src/Client/App/AdminPanel.Client.App.csproj -p:BlazorMode=BlazorHybrid -p:Configuration=Release -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:ApplicationDisplayVersion="${{ vars.APPLICATION_DISPLAY_VERSION }}" -p:ApplicationVersion="${{ vars.APPLICATION_VERSION }}" -f net8.0-android
run: dotnet build AdminPanel/src/Client/App/AdminPanel.Client.App.csproj -p:BlazorMode=BlazorHybrid -p:Configuration=Release -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:ApplicationDisplayVersion="${{ vars.APPLICATION_DISPLAY_VERSION }}" -p:ApplicationVersion="${{ vars.APPLICATION_VERSION }}" -f net8.0-android

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: android-bundle
path: src/Templates/AdminPanel/Bit.AdminPanel/src/Client/App/bin/Release/net8.0-android/*-Signed.*
path: AdminPanel/src/Client/App/bin/Release/net8.0-android/*-Signed.*

build_blazor_hybrid_maccatalyst:
name: build blazor hybrid (maccatalyst)
Expand All @@ -192,28 +213,35 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 18

- name: Create project from AdminPanel
run: |
cd src/Templates/AdminPanel && dotnet build -c Release
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.AdminPanel.0.0.0.nupkg
cd ../../../ && dotnet new bit-admin --name AdminPanel --database SqlServer
- name: Update appsettings.json api server address
uses: microsoft/variable-substitution@v1
with:
files: 'src/Templates/AdminPanel/Bit.AdminPanel/src/Client/Core/appsettings.json'
files: 'AdminPanel/src/Client/Core/appsettings.json'
env:
ApiServerAddress: ${{ env.API_SERVER_ADDRESS }}

- name: Install maui
run: cd src && dotnet workload install maui

- name: Generate CSS/JS files
run: dotnet build src/Templates/AdminPanel/Bit.AdminPanel/src/Client/Core/AdminPanel.Client.Core.csproj -t:BeforeBuildTasks --no-restore
run: dotnet build AdminPanel/src/Client/Core/AdminPanel.Client.Core.csproj -t:BeforeBuildTasks --no-restore

- name: Build pkg
run: dotnet build src/Templates/AdminPanel/Bit.AdminPanel/src/Client/App/AdminPanel.Client.App.csproj -p:BlazorMode=BlazorHybrid -p:Configuration=Release -p:CreatePackage=true -p:ApplicationDisplayVersion="${{ vars.APPLICATION_DISPLAY_VERSION }}" -p:ApplicationVersion="${{ vars.APPLICATION_VERSION }}" -f net8.0-maccatalyst
run: dotnet build AdminPanel/src/Client/App/AdminPanel.Client.App.csproj -p:BlazorMode=BlazorHybrid -p:Configuration=Release -p:CreatePackage=true -p:ApplicationDisplayVersion="${{ vars.APPLICATION_DISPLAY_VERSION }}" -p:ApplicationVersion="${{ vars.APPLICATION_VERSION }}" -f net8.0-maccatalyst

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: mac-pkg-bundle
path: src/Templates/AdminPanel/Bit.AdminPanel/src/Client/App/bin/release/net8.0-maccatalyst/*.pkg
path: AdminPanel/src/Client/App/bin/release/net8.0-maccatalyst/*.pkg

build_blazor_hybrid_ios:
name: build blazor hybrid (ios)
Expand All @@ -236,11 +264,18 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 18

- name: Create project from AdminPanel
run: |
cd src/Templates/AdminPanel && dotnet build -c Release
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.AdminPanel.0.0.0.nupkg
cd ../../../ && dotnet new bit-admin --name AdminPanel --database SqlServer
- name: Update appsettings.json api server address
uses: microsoft/variable-substitution@v1
with:
files: 'src/Templates/AdminPanel/Bit.AdminPanel/src/Client/Core/appsettings.json'
files: 'AdminPanel/src/Client/Core/appsettings.json'
env:
ApiServerAddress: ${{ env.API_SERVER_ADDRESS }}

Expand Down Expand Up @@ -269,16 +304,16 @@ jobs:
api-private-key: ${{ secrets.APPSTORE_API_KEY_PRIVATE_KEY }}

- name: Generate CSS/JS files
run: dotnet build src/Templates/AdminPanel/Bit.AdminPanel/src/Client/Core/AdminPanel.Client.Core.csproj -t:BeforeBuildTasks --no-restore
run: dotnet build AdminPanel/src/Client/Core/AdminPanel.Client.Core.csproj -t:BeforeBuildTasks --no-restore

- name: Build ipa
run: dotnet publish src/Templates/AdminPanel/Bit.AdminPanel/src/Client/App/AdminPanel.Client.App.csproj -p:RuntimeIdentifier=ios-arm64 -p:BlazorMode=BlazorHybrid -p:Configuration=Release -p:ArchiveOnBuild=true -p:CodesignKey="iPhone Distribution" -p:CodesignProvision="AdminPanel" -p:ApplicationDisplayVersion="${{ vars.APPLICATION_DISPLAY_VERSION }}" -p:ApplicationVersion="${{ vars.APPLICATION_VERSION }}" -f net8.0-ios
run: dotnet publish AdminPanel/src/Client/App/AdminPanel.Client.App.csproj -p:RuntimeIdentifier=ios-arm64 -p:BlazorMode=BlazorHybrid -p:Configuration=Release -p:ArchiveOnBuild=true -p:CodesignKey="iPhone Distribution" -p:CodesignProvision="AdminPanel" -p:ApplicationDisplayVersion="${{ vars.APPLICATION_DISPLAY_VERSION }}" -p:ApplicationVersion="${{ vars.APPLICATION_VERSION }}" -f net8.0-ios

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ios-bundle
path: src/Templates/AdminPanel/Bit.AdminPanel/src/Client/App/bin/release/net8.0-ios/ios-arm64/publish/*.ipa
path: AdminPanel/src/Client/App/bin/release/net8.0-ios/ios-arm64/publish/*.ipa

build_blazor_electron_linux:
name: build blazor electron (linux)
Expand All @@ -294,6 +329,13 @@ jobs:
with:
global-json-file: src/Templates/AdminPanel/Bit.AdminPanel/global.json

- name: Create project from AdminPanel
run: |
cd src/Templates/AdminPanel && dotnet build -c Release
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.AdminPanel.0.0.0.nupkg
cd ../../../ && dotnet new bit-admin --name AdminPanel --database SqlServer
- name: Setup .NET for Electron.NET
uses: actions/setup-dotnet@v3
with:
Expand All @@ -306,24 +348,24 @@ jobs:
- name: Update appsettings.json api server address
uses: microsoft/variable-substitution@v1
with:
files: 'src/Templates/AdminPanel/Bit.AdminPanel/src/Client/Core/appsettings.json'
files: 'AdminPanel/src/Client/Core/appsettings.json'
env:
ApiServerAddress: ${{ env.API_SERVER_ADDRESS }}

- name: Switch to BlazorElectron
run: awk '/<BlazorMode>/{sub(">.*</", ">BlazorElectron</")}1' src/Templates/AdminPanel/Bit.AdminPanel/src/Directory.Build.props > temp.xml && mv temp.xml src/Templates/AdminPanel/Bit.AdminPanel/src/Directory.Build.props
run: awk '/<BlazorMode>/{sub(">.*</", ">BlazorElectron</")}1' AdminPanel/src/Directory.Build.props > temp.xml && mv temp.xml AdminPanel/src/Directory.Build.props

- name: Generate CSS/JS files
run: dotnet build src/Templates/AdminPanel/Bit.AdminPanel/src/Client/Core/AdminPanel.Client.Core.csproj -t:BeforeBuildTasks --no-restore
run: dotnet build AdminPanel/src/Client/Core/AdminPanel.Client.Core.csproj -t:BeforeBuildTasks --no-restore

- name: Restore electron .net
run: dotnet build src/Templates/AdminPanel/Bit.AdminPanel/src/Client/Web/AdminPanel.Client.Web.csproj -t:BeforeBuildTasks
run: dotnet build AdminPanel/src/Client/Web/AdminPanel.Client.Web.csproj -t:BeforeBuildTasks

- name: Build app image
run: cd src/Templates/AdminPanel/Bit.AdminPanel/src/Client/Web/ && dotnet electronize build /target linux
run: cd AdminPanel/src/Client/Web/ && dotnet electronize build /target linux

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: linux-app-image
path: src/Templates/AdminPanel/Bit.AdminPanel/src/Client/Web/bin/Desktop/linux-unpacked
path: AdminPanel/src/Client/Web/bin/Desktop/linux-unpacked
Loading

0 comments on commit 3140e03

Please sign in to comment.