Build & Release #18
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 # needed to create releases | |
| packages: read | |
| 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 | |
| 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 | |
| # 2 ─ Install the .NET SDK | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '9.*.*' | |
| # 3 ─ Optional workloads (Uno/Maui, etc.) | |
| - name: Install .NET workloads | |
| working-directory: ./AluaAchievements | |
| run: dotnet workload restore | |
| # 4 ─ Restore NuGet packages | |
| - name: Restore dependencies | |
| working-directory: ./AluaAchievements | |
| run: dotnet restore Alua.sln | |
| # inside the “build” job steps | |
| - name: Write .env from secret | |
| working-directory: ./AluaAchievements/Alua # folder that holds Alua.csproj | |
| run: | | |
| # envcontent is expected to be the full text of the .env file | |
| printf '%s\n' "${{ secrets.envcontent }}" > .env | |
| # 5 ─ 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 | |
| -p:PublishSingleFile=true | |
| -o publish | |
| --no-restore | |
| # 6 ─ Zip the publish output | |
| - name: Archive artifact | |
| working-directory: ./AluaAchievements/publish | |
| run: 7z a ../../${{ matrix.art }}.zip * | |
| # 7 ─ Upload artifact 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 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 |