name: Build

# Verifies that every push to main and every PR still builds against the
# current Dalamud staging branch. Does not produce release artefacts; the
# release workflow handles that on tag.
#
# Linux runner: gitea.com Cloud Actions provides ubuntu-latest. The plugin
# csproj targets net10.0-windows, but `dotnet build` cross-compiles on
# Linux as long as the Dalamud staging assemblies are present at the
# expected lookup path ($(HOME)/.xlcore/dalamud/Hooks/dev/, which the
# Dalamud SDK 15 uses on Linux).

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
  workflow_dispatch:

# Minimum permissions for a build-only workflow: read the repo, nothing
# else. Closes the CodeQL "Workflow does not contain permissions" alert
# and matches the principle-of-least-privilege the security guide
# recommends for workflows that don't push or create releases.
permissions:
  contents: read

jobs:
  build:
    name: Build (Release)
    runs-on: ubuntu-latest
    timeout-minutes: 15

    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6

      - name: Setup .NET 10
        uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5
        with:
          dotnet-version: 10.0.x

      - name: Download Dalamud staging
        run: |
          hooks="$HOME/.xlcore/dalamud/Hooks/dev"
          mkdir -p "$hooks"
          curl -fsSL https://goatcorp.github.io/dalamud-distrib/stg/latest.zip -o dalamud.zip
          unzip -oq dalamud.zip -d "$hooks"

      - name: Restore
        run: dotnet restore HellionChat/HellionChat.csproj

      - name: Build (Release)
        run: dotnet build HellionChat/HellionChat.csproj --configuration Release --no-restore
