Build & Release #33
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 & Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Tag / version (e.g. v1.2.3)' | |
| required: true | |
| type: string | |
| jobs: | |
| # ---------- BUILD ---------- | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| DOTNET_RESTORE_LOCKED_MODE: false | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| rid: win-x64 | |
| fw: net9.0-desktop | |
| art: win-x64 | |
| binary_name: Alua.exe | |
| - os: macos-latest | |
| rid: osx-arm64 | |
| fw: net9.0-desktop | |
| art: osx-arm64 | |
| binary_name: Alua.app | |
| steps: | |
| # 1 ─ Checkout repositories | |
| - name: Checkout AluaAchievements | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: Rarisma/AluaAchievements | |
| path: AluaAchievements | |
| - name: Checkout SACHYA | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: rarisma/sachya | |
| path: SACHYA | |
| - name: Checkout Alua | |
| uses: actions/checkout@v4 | |
| with: | |
| path: Alua | |
| # 2 ─ Install the .NET SDK | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '9.0.x' | |
| # 3 ─ Install required workloads | |
| - name: Install .NET workloads | |
| run: dotnet workload install android | |
| # 4 ─ Extract version from input | |
| - name: Extract version number | |
| id: extract_version | |
| run: echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT | |
| # 5 ─ Restore dependencies | |
| - name: Restore dependencies | |
| run: dotnet restore Alua/Alua.sln | |
| # 6 ─ Clean publish directory | |
| - name: Clean publish directory (macOS) | |
| if: matrix.os == 'macos-latest' | |
| run: rm -rf publish | |
| - name: Clean publish directory (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: Remove-Item -Path publish -Recurse -Force -ErrorAction SilentlyContinue | |
| # 7 ─ Build and publish | |
| - name: Publish (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| dotnet publish Alua/Alua/Alua.csproj ` | |
| -c Release ` | |
| -f ${{ matrix.fw }} ` | |
| -r ${{ matrix.rid }} ` | |
| -p:UseMonoRuntime=false ` | |
| --self-contained ` | |
| -o publish | |
| - name: Publish (macOS) | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| dotnet publish Alua/Alua/Alua.csproj \ | |
| -c Release \ | |
| -f ${{ matrix.fw }} \ | |
| -r ${{ matrix.rid }} \ | |
| -p:UseMonoRuntime=false \ | |
| -p:PackageFormat=app \ | |
| -p:CodesignKey=- \ | |
| --self-contained \ | |
| -o publish | |
| # 8 ─ Package artifacts | |
| - name: Package Windows artifact | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| cd publish | |
| Compress-Archive -Path * -DestinationPath ../alua-${{ matrix.art }}.zip | |
| - name: Package macOS artifact | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| cd publish | |
| zip -r ../alua-${{ matrix.art }}.zip Alua.app | |
| # 9 ─ Upload artifacts | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: alua-${{ matrix.art }} | |
| path: alua-${{ matrix.art }}.zip | |
| # ---------- RELEASE ---------- | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ github.event.inputs.version }} | |
| name: Release ${{ github.event.inputs.version }} | |
| files: | | |
| alua-win-x64/alua-win-x64.zip | |
| alua-osx-arm64/alua-osx-arm64.zip | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |