misc: simplify actions.

This commit is contained in:
Zhang Dian
2025-05-30 17:36:59 +08:00
parent 82c1bf2100
commit 7b99270513
7 changed files with 68 additions and 54 deletions

View File

@@ -13,8 +13,13 @@ on:
- 'linux'
- 'android'
- 'all'
include_aot:
description: 'Include Windows AOT packaging'
win64:
description: 'Windows x64'
required: true
default: true
type: boolean
win64_aot:
description: 'Windows x64 AOT'
required: true
default: true
type: boolean
@@ -31,34 +36,36 @@ jobs:
run: mkdir upload
- name: Publish win-x64
run: dotnet publish demo/Ursa.Demo.Desktop -r win-x64 -c Release --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true -o ./publish/win64
if: ${{ github.event.inputs.win64 == 'true' }}
run: dotnet publish demo/Ursa.Demo.Desktop -r win-x64 -c Release -o publish/win64 --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true
- name: Zip win-x64
if: ${{ github.event.inputs.win64 == 'true' }}
run: |
$files = Get-ChildItem -Path ./publish/win64/* -Recurse -Exclude *.pdb
Compress-Archive -Path $files.FullName -DestinationPath ./upload/Ursa.Demo.Desktop.win-x64.zip
$files = Get-ChildItem -Path publish/win64/* -Recurse -Exclude *.pdb
Compress-Archive -Path $files.FullName -DestinationPath upload/Ursa.Demo.Desktop.win-x64.zip
- name: Enable Native AOT in .csproj
if: ${{ github.event.inputs.include_aot == 'true' }}
if: ${{ github.event.inputs.win64_aot == 'true' }}
run: |
sed -i 's#<!--<PublishAot>true</PublishAot>-->#<PublishAot>true</PublishAot>#' demo/Ursa.Demo.Desktop/Ursa.Demo.Desktop.csproj
sed -i 's#<!--<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>-->#<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>#' demo/Ursa.Demo.Desktop/Ursa.Demo.Desktop.csproj
- name: Publish win-x64 AOT
if: ${{ github.event.inputs.include_aot == 'true' }}
run: dotnet publish demo/Ursa.Demo.Desktop -r win-x64 -c Release -o ./publish/win64-aot
if: ${{ github.event.inputs.win64_aot == 'true' }}
run: dotnet publish demo/Ursa.Demo.Desktop -r win-x64 -c Release -o publish/win64-aot
- name: Zip win-x64 AOT
if: ${{ github.event.inputs.include_aot == 'true' }}
if: ${{ github.event.inputs.win64_aot == 'true' }}
run: |
$files = Get-ChildItem -Path ./publish/win64-aot/* -Recurse -Exclude *.pdb
Compress-Archive -Path $files.FullName -DestinationPath ./upload/Ursa.Demo.Desktop.win-x64.NativeAOT.zip
$files = Get-ChildItem -Path publish/win64-aot/* -Recurse -Exclude *.pdb
Compress-Archive -Path $files.FullName -DestinationPath upload/Ursa.Demo.Desktop.win-x64.NativeAOT.zip
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4.3.1
with:
name: windows
path: ./upload
path: upload
linux:
if: ${{ github.event.inputs.platform == 'linux' || github.event.inputs.platform == 'all' }}
@@ -71,16 +78,16 @@ jobs:
run: mkdir upload
- name: Publish linux-x64
run: dotnet publish demo/Ursa.Demo.Desktop -r linux-x64 -c Release --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true -o ./publish/linux64
run: dotnet publish demo/Ursa.Demo.Desktop -r linux-x64 -c Release -o publish/linux64 --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true
- name: Zip linux-x64
run: zip -j -r ./upload/Ursa.Demo.Desktop.linux-x64.zip ./publish/linux64 -x "*.pdb"
run: zip -j -r upload/Ursa.Demo.Desktop.linux-x64.zip publish/linux64 -x "*.pdb"
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4.3.1
with:
name: linux
path: ./upload
path: upload
android:
if: ${{ github.event.inputs.platform == 'android' || github.event.inputs.platform == 'all' }}
@@ -90,16 +97,16 @@ jobs:
uses: actions/checkout@v4.1.1
- name: CD Android
run: cd ./demo/Ursa.Demo.Android
run: cd demo/Ursa.Demo.Android
- name: Restore Dependencies
run: dotnet restore
- name: Publish Android
run: dotnet publish demo/Ursa.Demo.Android -c Release -f net8.0-android --no-restore -o ./publish -p:RuntimeIdentifier=android-arm64
run: dotnet publish demo/Ursa.Demo.Android -c Release -f net8.0-android --no-restore -o publish -p:RuntimeIdentifier=android-arm64
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4.3.1
with:
name: android
path: ./publish/*Signed.apk
path: publish/*Signed.apk