add a new build #5
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: ['v*'] | |
| jobs: | |
| build-desktop: | |
| name: Build Desktop (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| rid: linux-x64 | |
| artifact: linux-x64 | |
| - os: ubuntu-24.04-arm | |
| rid: linux-arm64 | |
| artifact: linux-arm64 | |
| - os: windows-latest | |
| rid: win-x64 | |
| artifact: win-x64 | |
| - os: windows-11-arm | |
| rid: win-arm64 | |
| artifact: win-arm64 | |
| - os: macos-latest | |
| rid: osx-arm64 | |
| artifact: osx-arm64 | |
| - os: macos-latest | |
| rid: osx-x64 | |
| artifact: osx-x64 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: '10.0.x' | |
| - name: Cache NuGet packages | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.nuget/packages | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Packages.props') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nuget- | |
| - name: Restore | |
| run: dotnet restore src/MyDesktopApplication.Desktop/MyDesktopApplication.Desktop.csproj | |
| - name: Publish | |
| shell: bash | |
| run: | | |
| dotnet publish src/MyDesktopApplication.Desktop/MyDesktopApplication.Desktop.csproj \ | |
| -c Release \ | |
| -r ${{ matrix.rid }} \ | |
| --self-contained true \ | |
| -p:PublishSingleFile=true \ | |
| -p:IncludeNativeLibrariesForSelfExtract=true \ | |
| -o ./publish/${{ matrix.artifact }} | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: desktop-${{ matrix.artifact }} | |
| path: ./publish/${{ matrix.artifact }} | |
| build-android: | |
| name: Build Android | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: '10.0.x' | |
| - name: Setup Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| - name: Install Android Workload | |
| run: dotnet workload install android | |
| - name: Cache NuGet packages | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.nuget/packages | |
| key: ${{ runner.os }}-android-nuget-${{ hashFiles('**/Directory.Packages.props') }} | |
| restore-keys: | | |
| ${{ runner.os }}-android-nuget- | |
| - name: Restore | |
| run: dotnet restore src/MyDesktopApplication.Android/MyDesktopApplication.Android.csproj | |
| - name: Build APK | |
| run: | | |
| dotnet build src/MyDesktopApplication.Android/MyDesktopApplication.Android.csproj \ | |
| -c Release \ | |
| -p:AndroidAapt2DaemonEnabled=false | |
| - name: Upload APK | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: android-apk | |
| path: src/MyDesktopApplication.Android/bin/Release/**/**.apk | |
| create-release: | |
| name: Create Release | |
| needs: [build-desktop, build-android] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download All Artifacts | |
| uses: actions/download-artifact@v7 | |
| with: | |
| path: ./artifacts | |
| pattern: '*' | |
| merge-multiple: false | |
| - name: Create Archives | |
| run: | | |
| cd artifacts | |
| for dir in */; do | |
| name="${dir%/}" | |
| if [[ "$name" == *"win"* ]]; then | |
| zip -r "../${name}.zip" "$dir" | |
| else | |
| tar -czvf "../${name}.tar.gz" "$dir" | |
| fi | |
| done | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: Release ${{ github.ref_name }} | |
| generate_release_notes: true | |
| files: | | |
| *.zip | |
| *.tar.gz |