Skip to content

Build & Release

Build & Release #19

Workflow file for this run

name: Build & Release
on:
workflow_dispatch:
inputs:
version:
description: 'Tag / version (e.g. v1.2.3)'
required: true
type: string
permissions:
contents: write
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
- os: macos-latest
rid: osx-arm64
fw: net9.0-macos
art: macos-arm64
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
# 5 ─ Materialise the .env file from a 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 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
# 7 ─ Zip the publish output (cross-platform)
- 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 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