.forgejo/workflows/release.yml triggers on annotated tag pushes matching v*.*.*. The workflow runs on a Windows runner (required for WiX MSI), restores and builds the Windows solution filter, runs unit tests (skipping the requires=ndi tier — CI runners don't have NDI), publishes TeamsISO.App + TeamsISO.Console for win-x64 framework-dependent, builds the WiX MSI scaffold, and uploads the MSI both as a workflow artifact (downloadable from the run page) and as an asset on the auto-created Release for the tag. Tag version is parsed from refs/tags/vX.Y.Z and threaded into /p:Version on every dotnet build invocation so the publish output, the assembly metadata, and the MSI ProductVersion all agree. Release-asset upload uses the Forgejo REST API directly via curl + Invoke-RestMethod rather than depending on a third-party action; if the auto-create-release-on-tag-push setting is off, the workflow creates the release itself. Pre-release flag is set when the tag contains -alpha/-beta/-rc. docs/RELEASING.md walks through cutting a release and flags the code-signing TODO (SignOutput property is wired but no cert; SmartScreen will warn on first launch until that lands).
132 lines
5 KiB
YAML
132 lines
5 KiB
YAML
name: Release
|
|
|
|
# Triggered by pushing an annotated tag of the form v1.2.3 (or any v-prefixed
|
|
# semver). The job runs on a Windows runner because building the WiX MSI
|
|
# requires the WiX SDK which is supported on Windows; the engine + console
|
|
# can in principle be built on Linux, but for simplicity we do everything in
|
|
# one job here so the publish output paths line up for the installer.
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*.*.*'
|
|
|
|
jobs:
|
|
build-msi:
|
|
runs-on: windows-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0 # tags + full history needed to derive the version
|
|
|
|
- name: Derive version from tag
|
|
id: ver
|
|
shell: pwsh
|
|
run: |
|
|
# GITHUB_REF is refs/tags/vX.Y.Z; strip the prefix.
|
|
$tag = "${env:GITHUB_REF}".Replace('refs/tags/', '')
|
|
$version = $tag.TrimStart('v')
|
|
"tag=$tag" >> $env:GITHUB_OUTPUT
|
|
"version=$version" >> $env:GITHUB_OUTPUT
|
|
Write-Host "Building version $version (tag $tag)"
|
|
|
|
- name: Setup .NET 8
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: 8.0.x
|
|
|
|
- name: Restore (Windows solution filter)
|
|
run: dotnet restore TeamsISO.Windows.slnf
|
|
|
|
- name: Build (Release, treat warnings as errors)
|
|
run: dotnet build TeamsISO.Windows.slnf --configuration Release --no-restore /p:Version=${{ steps.ver.outputs.version }}
|
|
|
|
- name: Run unit tests (excluding requires=ndi)
|
|
run: >
|
|
dotnet test TeamsISO.Windows.slnf
|
|
--configuration Release
|
|
--no-build
|
|
--filter "Category!=ndi&requires!=ndi"
|
|
|
|
- name: Publish TeamsISO.App (framework-dependent, win-x64)
|
|
run: >
|
|
dotnet publish src/TeamsISO.App/TeamsISO.App.csproj
|
|
--configuration Release
|
|
--runtime win-x64
|
|
--self-contained false
|
|
--output publish/TeamsISO
|
|
/p:Version=${{ steps.ver.outputs.version }}
|
|
|
|
- name: Publish TeamsISO.Console (framework-dependent, win-x64)
|
|
run: >
|
|
dotnet publish src/TeamsISO.Console/TeamsISO.Console.csproj
|
|
--configuration Release
|
|
--runtime win-x64
|
|
--self-contained false
|
|
--output publish/TeamsISO-Console
|
|
/p:Version=${{ steps.ver.outputs.version }}
|
|
|
|
- name: Build MSI installer
|
|
run: >
|
|
dotnet build installer/TeamsISO.Installer.wixproj
|
|
--configuration Release
|
|
/p:Version=${{ steps.ver.outputs.version }}
|
|
|
|
- name: Locate MSI
|
|
id: msi
|
|
shell: pwsh
|
|
run: |
|
|
$msi = Get-ChildItem -Path installer/bin -Recurse -Filter '*.msi' | Select-Object -First 1
|
|
if (-not $msi) { throw "No MSI produced under installer/bin." }
|
|
"path=$($msi.FullName)" >> $env:GITHUB_OUTPUT
|
|
"name=$($msi.Name)" >> $env:GITHUB_OUTPUT
|
|
Write-Host "MSI: $($msi.FullName) ($($msi.Length) bytes)"
|
|
|
|
- name: Upload MSI as workflow artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ steps.msi.outputs.name }}
|
|
path: ${{ steps.msi.outputs.path }}
|
|
|
|
# Forgejo doesn't ship a stable upload-release-asset action, so we use
|
|
# the REST API directly. This: (1) finds the release that the tag push
|
|
# auto-created, (2) uploads the MSI as an asset on it. Requires that
|
|
# the repo's "Create a release on tag push" setting is on, OR that the
|
|
# release was created beforehand. If no release exists, we create one.
|
|
- name: Attach MSI to release
|
|
shell: pwsh
|
|
env:
|
|
FORGE_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
FORGE_API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
|
|
TAG: ${{ steps.ver.outputs.tag }}
|
|
MSI_PATH: ${{ steps.msi.outputs.path }}
|
|
MSI_NAME: ${{ steps.msi.outputs.name }}
|
|
run: |
|
|
$headers = @{ Authorization = "token $env:FORGE_TOKEN" }
|
|
|
|
# Find the release for this tag.
|
|
try {
|
|
$release = Invoke-RestMethod -Method Get `
|
|
-Uri "$env:FORGE_API/releases/tags/$env:TAG" -Headers $headers
|
|
} catch {
|
|
Write-Host "No release found for $env:TAG; creating one."
|
|
$body = @{
|
|
tag_name = $env:TAG
|
|
name = "TeamsISO $env:TAG"
|
|
body = "Automated build from tag $env:TAG."
|
|
draft = $false
|
|
prerelease = $env:TAG -match '-(alpha|beta|rc)'
|
|
} | ConvertTo-Json
|
|
$release = Invoke-RestMethod -Method Post `
|
|
-Uri "$env:FORGE_API/releases" -Headers $headers `
|
|
-ContentType 'application/json' -Body $body
|
|
}
|
|
|
|
# Upload the MSI as an asset.
|
|
$uploadUri = "$env:FORGE_API/releases/$($release.id)/assets?name=$env:MSI_NAME"
|
|
curl.exe -fSL `
|
|
-H "Authorization: token $env:FORGE_TOKEN" `
|
|
-H "Content-Type: application/octet-stream" `
|
|
--upload-file "$env:MSI_PATH" `
|
|
"$uploadUri"
|
|
Write-Host "Asset $env:MSI_NAME attached to release $env:TAG."
|