9640d336a6
- codeql.yml removed: GitHub-only (uses github/codeql-action/*). - build.yml + release.yml: runs-on switched to ubuntu-latest (Gitea Cloud has no Windows runner). Dalamud staging is now downloaded via curl/unzip into $HOME/.xlcore/dalamud/Hooks/dev/, the path the Dalamud SDK 15 uses on Linux. Locate-step uses find instead of Get-ChildItem. - release.yml: softprops/action-gh-release replaced with the Gitea-native https://gitea.com/actions/release-action. Auto-injected GITHUB_TOKEN on Gitea Actions has Gitea-API scope and is sufficient. - forge-announce.yml: environment: Webhook removed (Gitea has no environments — DISCORD_FORGE_WEBHOOK is a repo-level Actions secret). avatar_url and embed url switched from raw.githubusercontent.com / github.com to gitea.com. - release-footer.md: install URL plus the five doc links (README, PRIVACY, THIRD_PARTY_NOTICES, SECURITY, SUPPORT) and LICENSE link switched to gitea.com/.../src/branch/main/. ChatTwo upstream link stays on GitHub.
171 lines
7.1 KiB
YAML
171 lines
7.1 KiB
YAML
name: Release
|
|
|
|
# Triggered when a vX.Y.Z tag is pushed. Builds the plugin against the
|
|
# current Dalamud staging branch, locates the latest.zip produced by
|
|
# DalamudPackager and attaches it to the matching Gitea Release.
|
|
#
|
|
# User-controlled inputs touched by this workflow:
|
|
# - the tag name (filtered by on.tags = v*, validated again at runtime
|
|
# against ^v\d+\.\d+\.\d+$ before being used in any string)
|
|
# All other values are either repo-controlled (paths under
|
|
# HellionChat/bin/Release derived from find / Get-ChildItem) or pinned
|
|
# URLs to goatcorp / gitea. Nothing from a webhook event payload (issue/PR
|
|
# titles, commit messages, etc.) flows into a run-step.
|
|
#
|
|
# Linux runner: gitea.com Cloud Actions only ships ubuntu-latest. The
|
|
# plugin csproj targets net10.0-windows, `dotnet build` cross-compiles on
|
|
# Linux when the Dalamud staging assemblies sit under $(HOME)/.xlcore/...
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
# Manual recovery trigger. Use when a tag was pushed but the auto-run
|
|
# was missed or failed: `gh workflow run release.yml -f tag=v0.6.1`.
|
|
# The tag input is validated against the same semver regex as the
|
|
# auto-trigger before any string interpolation happens.
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: 'Existing tag to (re)release, e.g. v0.6.1'
|
|
required: true
|
|
type: string
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
release:
|
|
name: Build and attach release ZIP
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
|
|
steps:
|
|
# On push:tags, github.ref_name is the tag — checkout default works.
|
|
# On workflow_dispatch, ref defaults to the branch the action was
|
|
# invoked from; we need to explicitly check out the tag the user
|
|
# supplied so the build comes from the tagged commit, not main.
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
ref: ${{ github.event.inputs.tag || github.ref }}
|
|
|
|
- name: Setup .NET 10
|
|
uses: actions/setup-dotnet@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: Build (Release)
|
|
run: dotnet build HellionChat/HellionChat.csproj --configuration Release
|
|
|
|
- name: Locate latest.zip
|
|
id: locate
|
|
run: |
|
|
zip="$(find HellionChat/bin/Release -name latest.zip -print -quit)"
|
|
if [ -z "$zip" ]; then
|
|
echo "latest.zip not found under HellionChat/bin/Release" >&2
|
|
exit 1
|
|
fi
|
|
echo "Found: $zip"
|
|
echo "path=$zip" >> "$GITHUB_OUTPUT"
|
|
|
|
# Build a release body from the matching changelog block in
|
|
# HellionChat.yaml plus a static install / docs footer. Fails the
|
|
# workflow if no block exists for the tagged version, which is the
|
|
# automated counterpart to the "yaml + repo.json + release body
|
|
# kept in sync" rule.
|
|
#
|
|
# GITHUB_REF_NAME is read via env: (not ${{ }} interpolation) so the
|
|
# tag value is treated as a PowerShell variable, not as inline shell
|
|
# text. The strict regex below rejects anything that is not a clean
|
|
# semver tag before it is used to build a string.
|
|
- name: Generate release body
|
|
shell: pwsh
|
|
env:
|
|
# workflow_dispatch carries the user-supplied tag in inputs.tag;
|
|
# push:tags carries it in github.ref_name. Either way the value
|
|
# is treated as a PowerShell variable (env-var pass), not as
|
|
# inline shell text, and validated against the semver regex
|
|
# below before any string interpolation.
|
|
TAG_NAME: ${{ github.event.inputs.tag || github.ref_name }}
|
|
run: |
|
|
$tag = $env:TAG_NAME
|
|
if ($tag -notmatch '^v\d+\.\d+\.\d+$') {
|
|
throw "Refusing to generate release body for non-semver tag: $tag"
|
|
}
|
|
$version = $tag.Substring(1)
|
|
|
|
$yamlPath = "HellionChat/HellionChat.yaml"
|
|
$raw = Get-Content -Path $yamlPath -Raw
|
|
|
|
$marker = "changelog: |-"
|
|
$idx = $raw.IndexOf($marker)
|
|
if ($idx -lt 0) { throw "changelog block not found in $yamlPath" }
|
|
|
|
# changelog: is the last top-level key in the manifest, so
|
|
# everything after the marker is the literal block. Strip the
|
|
# 2-space yaml indent from each line.
|
|
$afterMarker = $raw.Substring($idx + $marker.Length)
|
|
$changelogBody = (($afterMarker -split "`r?`n") | ForEach-Object {
|
|
if ($_ -match '^ ') { $_.Substring(2) } else { $_ }
|
|
}) -join "`n"
|
|
|
|
$header = "**Hellion Chat $version"
|
|
$start = $changelogBody.IndexOf($header)
|
|
if ($start -lt 0) {
|
|
throw "No changelog entry for version $version found in $yamlPath. Update the changelog block before tagging a release."
|
|
}
|
|
|
|
$rest = $changelogBody.Substring($start)
|
|
$nextHdr = $rest.IndexOf("`n`n**Hellion Chat ", 1)
|
|
$trailer = $rest.IndexOf("`n`n---")
|
|
|
|
if ($nextHdr -ge 0 -and ($trailer -lt 0 -or $nextHdr -lt $trailer)) {
|
|
$currentBlock = $rest.Substring(0, $nextHdr).TrimEnd()
|
|
} elseif ($trailer -ge 0) {
|
|
$currentBlock = $rest.Substring(0, $trailer).TrimEnd()
|
|
} else {
|
|
$currentBlock = $rest.TrimEnd()
|
|
}
|
|
|
|
# Static install / docs / licence footer is maintained as a
|
|
# separate file so the workflow YAML stays clean (no embedded
|
|
# heredoc that would have to be indented under the run-block).
|
|
$footerPath = ".github/release-footer.md"
|
|
if (-not (Test-Path $footerPath)) {
|
|
throw "Release footer template not found: $footerPath"
|
|
}
|
|
$footer = Get-Content -Path $footerPath -Raw
|
|
|
|
$body = $currentBlock + "`n" + $footer
|
|
$body | Out-File -FilePath release-body.md -Encoding utf8 -NoNewline
|
|
|
|
Write-Host "Generated release body for $tag :"
|
|
Write-Host "----------------------------------------"
|
|
Write-Host $body
|
|
Write-Host "----------------------------------------"
|
|
|
|
# Gitea-native release action. Creates the release if the tag has no
|
|
# release yet, or updates the existing one. body_path provides the
|
|
# generated release body, files attaches latest.zip. The auto-injected
|
|
# GITHUB_TOKEN on Gitea Actions has Gitea-API scope and is sufficient
|
|
# for release write.
|
|
- name: Attach to Gitea release
|
|
uses: https://gitea.com/actions/release-action@main
|
|
with:
|
|
# Explicit tag_name so the action targets the correct release in
|
|
# both push:tags (auto) and workflow_dispatch (manual recovery)
|
|
# modes. Without this, dispatch runs would default to the branch
|
|
# ref (main) and fail to find the release.
|
|
tag_name: ${{ github.event.inputs.tag || github.ref_name }}
|
|
files: ${{ steps.locate.outputs.path }}
|
|
body_path: release-body.md
|
|
api_key: ${{ secrets.GITHUB_TOKEN }}
|