use bash everywhere #9
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: Build | |
| on: | |
| push: | |
| branches: [master, main, develop] | |
| concurrency: | |
| group: build-${{ github.ref }} | |
| cancel-in-progress: true | |
| 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-13 | |
| 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 }} | |
| retention-days: 5 | |
| 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 | |
| retention-days: 5 | |
| create-prerelease: | |
| name: Create Pre-release | |
| needs: [build-desktop, build-android] | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' | |
| 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: Delete Previous Dev Release | |
| uses: dev-drprasad/[email protected] | |
| with: | |
| tag_name: dev | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| delete_release: true | |
| continue-on-error: true | |
| - name: Create Dev Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: dev | |
| name: Development Build | |
| prerelease: true | |
| body: | | |
| 🚧 **Development Build** | |
| This is an automatically generated pre-release from the latest commit on `${{ github.ref_name }}`. | |
| **Commit:** ${{ github.sha }} | |
| **Date:** ${{ github.event.head_commit.timestamp }} | |
| ⚠️ This build may be unstable. Use at your own risk. | |
| files: | | |
| *.zip | |
| *.tar.gz |