diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml new file mode 100644 index 0000000..8fee096 --- /dev/null +++ b/.github/workflows/release-tag.yml @@ -0,0 +1,149 @@ +name: Release Tag + +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+.[0-9]+" + workflow_dispatch: + +jobs: + pack: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Pack Semi.Avalonia + run: dotnet pack ./src/Semi.Avalonia -o ./nugets + + - name: Pack Semi.Avalonia.ColorPicker + run: dotnet pack ./src/Semi.Avalonia.ColorPicker -o ./nugets + + - name: Pack Semi.Avalonia.DataGrid + run: dotnet pack ./src/Semi.Avalonia.DataGrid -o ./nugets + + - name: Upload a Build Artifact + uses: actions/upload-artifact@v4 + with: + name: nugets + path: ./nugets + + publish-windows: + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Make upload directory + run: mkdir upload + + - name: Publish win-x64 + run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r win-x64 -c Release --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true -o ./publish/win64 + + - name: Zip win-x64 + run: | + $files = Get-ChildItem -Path ./publish/win64/* -Recurse -Exclude *.pdb + Compress-Archive -Path $files.FullName -DestinationPath ./upload/Semi.Avalonia.Demo.Desktop.win-x64.zip + + - name: Enable Native AOT in .csproj + run: | + sed -i 's##true#' demo/Semi.Avalonia.Demo.Desktop/Semi.Avalonia.Demo.Desktop.csproj + sed -i 's##true#' demo/Semi.Avalonia.Demo.Desktop/Semi.Avalonia.Demo.Desktop.csproj + + - name: Publish win-x64 AOT + run: dotnet publish demo/Semi.Avalonia.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/Semi.Avalonia.Demo.Desktop.win-x64.NativeAOT.zip + + - name: Upload a Build Artifact + uses: actions/upload-artifact@v4 + with: + name: windows + path: ./upload + + publish-linux: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Make upload directory + run: mkdir upload + + - name: Publish linux-x64 + run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r linux-x64 -c Release --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true -o ./publish/linux64 + + - name: Zip linux-x64 + run: zip -j -r ./upload/Semi.Avalonia.Demo.Desktop.linux-x64.zip ./publish/linux64 -x "*.pdb" + + - name: Publish linux-x64 DRM + run: dotnet publish demo/Semi.Avalonia.Demo.Drm -r linux-x64 -c Release --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true -o ./publish/drm + + - name: Zip linux-x64 DRM + run: zip -j -r ./upload/Semi.Avalonia.Demo.Drm.linux-x64.zip ./publish/drm -x "*.pdb" + + - name: Upload a Build Artifact + uses: actions/upload-artifact@v4 + with: + name: linux + path: ./upload + + publish-android: + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: CD Android + run: cd ./demo/Semi.Avalonia.Demo.Android + + - name: Restore Dependencies + run: dotnet restore + + - name: Publish Android + run: dotnet publish demo/Semi.Avalonia.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 + + draft-release: + needs: [ pack, publish-windows, publish-linux, publish-android ] + runs-on: ubuntu-latest + steps: + - name: Download nugets Artifacts + uses: actions/download-artifact@v4 + with: + name: nugets + + - name: Download windows Artifacts + uses: actions/download-artifact@v4 + with: + name: windows + + - name: Download linux Artifacts + uses: actions/download-artifact@v4 + with: + name: linux + + - name: Download android Artifacts + uses: actions/download-artifact@v4 + with: + name: android + + - name: Release + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' + with: + generate_release_notes: true + draft: true + files: | + *.nupkg + *.zip + *.apk diff --git a/Semi.Avalonia.sln b/Semi.Avalonia.sln index 210c5d4..41c8732 100644 --- a/Semi.Avalonia.sln +++ b/Semi.Avalonia.sln @@ -18,6 +18,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GitHub Action", "GitHub Act .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 EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Demo", "Demo", "{43091528-9509-43CB-A003-9C5C11E96DD6}"