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

@@ -24,9 +24,6 @@ jobs:
- name: Publish .NET Project
run: dotnet publish $PROJECT_PATH -c Release --nologo
- name: Change base-tag in index.html
run: sed -i 's#<base href="/" />#<base href="/Ursa.Avalonia/" />#g' $OUTPUT_PATH/index.html
- name: copy index.html to 404.html
run: cp $OUTPUT_PATH/index.html $OUTPUT_PATH/404.html

View File

@@ -45,29 +45,29 @@ jobs:
- name: Pack Ursa
if: ${{ github.event.inputs.Ursa == 'true' }}
run: dotnet pack ./src/Ursa -o ./nugets /p:Version=${{ env.VERSION }}
run: dotnet pack src/Ursa -o nugets /p:Version=${{ env.VERSION }}
- name: Pack Ursa.Themes.Semi
if: ${{ github.event.inputs.Ursa_Themes_Semi == 'true' }}
run: dotnet pack ./src/Ursa.Themes.Semi -o ./nugets /p:Version=${{ env.VERSION }}
run: dotnet pack src/Ursa.Themes.Semi -o nugets /p:Version=${{ env.VERSION }}
- name: Pack Prism Extension
if: ${{ github.event.inputs.PrismExtension == 'true' }}
run: dotnet pack ./src/Ursa.PrismExtension -o ./nugets /p:Version=${{ env.VERSION }}
run: dotnet pack src/Ursa.PrismExtension -o nugets /p:Version=${{ env.VERSION }}
- name: Pack ReactiveUI Extension
if: ${{ github.event.inputs.ReactiveUIExtension == 'true' }}
run: dotnet pack ./src/Ursa.ReactiveUIExtension -o ./nugets /p:Version=${{ env.VERSION }}
run: dotnet pack src/Ursa.ReactiveUIExtension -o nugets /p:Version=${{ env.VERSION }}
- name: Add NuGet Source
run: dotnet nuget add source ${{ secrets.IRIHI_NUGET_NIGHTLY_FEED }} -n irihi.tech -u ${{ secrets.IRIHI_NUGET_USERNAME }} -p ${{ secrets.IRIHI_NUGET_PASSWORD }} --store-password-in-clear-text
- name: Publish Nightly Package
run: dotnet nuget push "./nugets/*.nupkg" --api-key ${{ secrets.IRIHI_NUGET_API_KEY }} --source irihi.tech --skip-duplicate
run: dotnet nuget push "nugets/*.nupkg" --api-key ${{ secrets.IRIHI_NUGET_API_KEY }} --source irihi.tech --skip-duplicate
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4.3.1
with:
name: nugets
path: ./nugets
path: nugets
if: always()

View File

@@ -33,26 +33,26 @@ jobs:
- name: Pack Ursa
if: ${{ github.event.inputs.Ursa == 'true' }}
run: dotnet pack ./src/Ursa -o ./nugets
run: dotnet pack src/Ursa -o nugets
- name: Pack Ursa.Themes.Semi
if: ${{ github.event.inputs.Ursa_Themes_Semi == 'true' }}
run: dotnet pack ./src/Ursa.Themes.Semi -o ./nugets
run: dotnet pack src/Ursa.Themes.Semi -o nugets
- name: Pack Prism Extension
if: ${{ github.event.inputs.PrismExtension == 'true' }}
run: dotnet pack ./src/Ursa.PrismExtension -o ./nugets
run: dotnet pack src/Ursa.PrismExtension -o nugets
- name: Pack ReactiveUI Extension
if: ${{ github.event.inputs.ReactiveUIExtension == 'true' }}
run: dotnet pack ./src/Ursa.ReactiveUIExtension -o ./nugets
run: dotnet pack src/Ursa.ReactiveUIExtension -o nugets
- name: Publish NuGet package
run: dotnet nuget push "./nugets/*.nupkg" --api-key ${{ secrets.NUGET_ORG_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
run: dotnet nuget push "nugets/*.nupkg" --api-key ${{ secrets.NUGET_ORG_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4.3.1
with:
name: nugets
path: ./nugets
path: nugets
if: always()

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

View File

@@ -15,16 +15,16 @@ jobs:
uses: actions/checkout@v4
- name: Pack Ursa
run: dotnet pack ./src/Ursa -o ./nugets
run: dotnet pack src/Ursa -o nugets
- name: Pack Ursa.Themes.Semi
run: dotnet pack ./src/Ursa.Themes.Semi -o ./nugets
run: dotnet pack src/Ursa.Themes.Semi -o nugets
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
with:
name: nugets
path: ./nugets
path: nugets
publish-windows:
runs-on: windows-latest
@@ -36,12 +36,12 @@ 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
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
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
run: |
@@ -49,18 +49,18 @@ jobs:
sed -i 's#<!--<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>-->#<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>#' demo/Ursa.Demo.Desktop/Ursa.Demo.Desktop.csproj
- name: Publish win-x64 AOT
run: dotnet publish demo/Ursa.Demo.Desktop -r win-x64 -c Release -o ./publish/win64-aot
run: dotnet publish demo/Ursa.Demo.Desktop -r win-x64 -c Release -o publish/win64-aot
- name: Zip win-x64 AOT
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
with:
name: windows
path: ./upload
path: upload
publish-linux:
runs-on: ubuntu-latest
@@ -72,16 +72,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
with:
name: linux
path: ./upload
path: upload
publish-android:
runs-on: windows-latest
@@ -90,19 +90,19 @@ jobs:
uses: actions/checkout@v4
- 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
with:
name: android
path: ./publish/*Signed.apk
path: publish/*Signed.apk
draft-release:
needs: [ pack, publish-windows, publish-linux, publish-android ]

View File

@@ -2,7 +2,7 @@ name: Test
on:
push:
branches: [ "main", "action/publish" ]
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
@@ -14,9 +14,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Ursa Unit Test
run: dotnet test ./tests/Test.Ursa
run: dotnet test tests/Test.Ursa
- name: Ursa Headless Test
run: dotnet test ./tests/HeadlessTest.Ursa
run: dotnet test tests/HeadlessTest.Ursa
ubuntu:
runs-on: ubuntu-latest
@@ -24,6 +24,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Ursa Unit Test
run: dotnet test ./tests/Test.Ursa
run: dotnet test tests/Test.Ursa
- name: Ursa Headless Test
run: dotnet test ./tests/HeadlessTest.Ursa
run: dotnet test tests/HeadlessTest.Ursa