Build & Release #13
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 | |
| permissions: | |
| contents: write # create releases | |
| packages: read # read packages | |
| jobs: | |
| # ---------- BUILD ---------- | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| DOTNET_RESTORE_LOCKED_MODE: false | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Desktop builds | |
| - os: windows-latest | |
| rid: win-x64 | |
| fw: net9.0-windows10.0.19041.0 | |
| art: win-x64 | |
| - os: macos-latest | |
| rid: osx-arm64 | |
| fw: net9.0-macos | |
| art: macos-arm64 | |
| steps: | |
| # 1 Checkout main repo | |
| - name: Checkout AluaAchievements repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: Rarisma/AluaAchievements | |
| path: AluaAchievements | |
| # 2 Checkout sibling repo (if needed by the solution) | |
| - name: Checkout Sachya repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: rarisma/sachya | |
| path: SACHYA | |
| # 3 Install .NET SDK | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '9.*.*' | |
| # 4 Restore any optional workloads (Uno/Maui, etc.) | |
| - name: Install .NET workloads | |
| working-directory: ./AluaAchievements | |
| run: dotnet workload restore | |
| # 5 NuGet restore | |
| - name: Restore dependencies | |
| working-directory: ./AluaAchievements | |
| run: dotnet restore Alua.sln | |
| # 6 Publish self-contained single-file binaries | |
| - name: Publish application | |
| working-directory: ./AluaAchievements | |
| run: | | |
| dotnet publish Alua/Alua.csproj \ | |
| -c Release \ | |
| -f ${{ matrix.fw }} \ | |
| -r ${{ matrix.rid }} \ | |
| --self-contained true \ | |
| -p:PublishSingleFile=true \ | |
| -o publish \ | |
| --no-restore | |
| # 7 Zip the publish folder | |
| - name: Archive artifact | |
| working-directory: ./AluaAchievements | |
| run: 7z a ../${{ matrix.art }}.zip ./publish/* | |
| # 8 Upload for the release job | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.art }} | |
| path: ${{ matrix.art }}.zip | |
| # ---------- RELEASE ---------- | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| - name: Create Release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| tag: ${{ github.event.inputs.version }} | |
| name: ${{ github.event.inputs.version }} | |
| artifacts: "dist/**/*.zip" | |
| generateReleaseNotes: true |