From 7b9927051347fe1e666621ab1a02cb53a7b9afa4 Mon Sep 17 00:00:00 2001 From: Zhang Dian <54255897+zdpcdt@users.noreply.github.com> Date: Fri, 30 May 2025 17:36:59 +0800 Subject: [PATCH] misc: simplify actions. --- .github/workflows/deploy.yml | 3 --- .github/workflows/pack-nightly.yml | 12 ++++----- .github/workflows/pack.yml | 12 ++++----- .github/workflows/publish.yml | 43 +++++++++++++++++------------- .github/workflows/release-tag.yml | 32 +++++++++++----------- .github/workflows/test.yml | 10 +++---- Ursa.sln | 10 +++++++ 7 files changed, 68 insertions(+), 54 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 8a7cd63..c7e210d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -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###g' $OUTPUT_PATH/index.html - - name: copy index.html to 404.html run: cp $OUTPUT_PATH/index.html $OUTPUT_PATH/404.html diff --git a/.github/workflows/pack-nightly.yml b/.github/workflows/pack-nightly.yml index bd21ba8..540cea3 100644 --- a/.github/workflows/pack-nightly.yml +++ b/.github/workflows/pack-nightly.yml @@ -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() \ No newline at end of file diff --git a/.github/workflows/pack.yml b/.github/workflows/pack.yml index 1a5ab9f..edf6b31 100644 --- a/.github/workflows/pack.yml +++ b/.github/workflows/pack.yml @@ -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() \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 05c9b28..7a91bc4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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##true#' demo/Ursa.Demo.Desktop/Ursa.Demo.Desktop.csproj sed -i 's##true#' 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 diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml index 0a3f345..3ab9620 100644 --- a/.github/workflows/release-tag.yml +++ b/.github/workflows/release-tag.yml @@ -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##true#' 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 ] diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a83b971..9f4b569 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/Ursa.sln b/Ursa.sln index 7b48952..695f774 100644 --- a/Ursa.sln +++ b/Ursa.sln @@ -39,6 +39,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test.Ursa", "tests\Test.Urs EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeadlessTest.Ursa", "tests\HeadlessTest.Ursa\HeadlessTest.Ursa.csproj", "{2D1C279E-7FFF-4630-92CC-CB2C33C3F80F}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GitHub Action", "GitHub Action", "{66123AC1-7C8C-4AA0-BBDB-5CC3E647A741}" + ProjectSection(SolutionItems) = preProject + .github\workflows\deploy.yml = .github\workflows\deploy.yml + .github\workflows\pack.yml = .github\workflows\pack.yml + .github\workflows\pack-nightly.yml = .github\workflows\pack-nightly.yml + .github\workflows\publish.yml = .github\workflows\publish.yml + .github\workflows\release-tag.yml = .github\workflows\release-tag.yml + .github\workflows\test.yml = .github\workflows\test.yml + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU