Build & Release #27
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 | |
| jobs: | |
| # ────────────────── BUILD ────────────────── | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| DOTNET_RESTORE_LOCKED_MODE: false | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Windows | |
| - os: windows-latest | |
| rid: win-x64 | |
| fw: net9.0-desktop | |
| art: win-x64 | |
| # macOS (Apple Silicon) | |
| - os: macos-latest | |
| rid: osx-arm64 | |
| fw: net9.0-desktop | |
| art: macos-arm64 | |
| steps: | |
| # 1 ─ 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 | |
| # 2 ─ .NET SDK -------------------------------------------------------------- | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '9.*.*' # install latest .NET 9 preview | |
| # 3 ─ Optional workloads (Uno / MAUI) -------------------------------------- | |
| - name: Restore .NET workloads | |
| working-directory: ./AluaAchievements | |
| run: dotnet workload restore # restores workloads listed in manifest | |
| # ► EXTRA — macOS workload | |
| - name: Install macOS workload | |
| if: matrix.os == 'macos-latest' | |
| run: dotnet workload install macos # needed for net9.0-desktop on macOS‑ARM | |
| # 4 ─ Restore NuGet packages (fixed) --------------------------------------- | |
| - name: Restore project packages | |
| working-directory: ./AluaAchievements | |
| run: | | |
| dotnet restore Alua/Alua.csproj \ | |
| -p:TargetFramework=${{ matrix.fw }} \ | |
| -r ${{ matrix.rid }} | |
| # 5 ─ Write .env from secret ---------------------------------------------- | |
| - name: Write .env from secret | |
| working-directory: ./AluaAchievements/Alua | |
| shell: bash | |
| run: printf '%s\n' "${{ secrets.envcontent }}" > .env | |
| # 6 ─ Publish self‑contained single file ----------------------------------- | |
| - name: Publish application | |
| working-directory: ./AluaAchievements | |
| run: | | |
| dotnet publish Alua/Alua.csproj \ | |
| -c Release \ | |
| -f ${{ matrix.fw }} \ | |
| -r ${{ matrix.rid }} \ | |
| --self-contained \ | |
| -p:PublishSingleFile=true \ | |
| -o publish \ | |
| --no-restore # restore already done | |
| # 7 ─ Zip publish output ---------------------------------------------------- | |
| - name: Archive artifact | |
| working-directory: ./AluaAchievements/publish | |
| shell: bash | |
| run: | | |
| if command -v 7z >/dev/null 2>&1; then | |
| 7z a ../../${{ matrix.art }}.zip * | |
| else | |
| zip -r ../../${{ matrix.art }}.zip . | |
| fi | |
| # 8 ─ Upload artifact ------------------------------------------------------- | |
| - 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 artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| - name: Create GitHub release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| tag: ${{ github.event.inputs.version }} | |
| name: ${{ github.event.inputs.version }} | |
| artifacts: "dist/**/*.zip" | |
| generateReleaseNotes: true |