Files
Chronos/.github/workflows/release.yml
T
Claude d0beb7d3bf ci(release): publish the public releases repository; fix signing and token conditions
The step conditions read step-level env, which a step's own if cannot see:
signing never ran and every release went to this repository. Secrets now
surface as job-level HAS_* flags. The publish job sets up .NET for make-icon,
re-publishing a tag updates the existing release, the portable zip carries
portable.txt, and tags are validated before anything is built.

deploy/releases-repo holds the public README, EULA draft, SECURITY policy and
issue forms; release.yml copies them with the Unraid template, compose file,
screenshots, i18n and SHA256SUMS. The fixtures command reports missing
samples as warning annotations (--allow-missing) instead of a silent pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
2026-10-02 22:15:21 +00:00

305 lines
13 KiB
YAML

name: Release
# A tag vMAJOR.MINOR.PATCH[-PRERELEASE] builds, tests, signs (when certificates are configured) and publishes
# everything (BRIEF §19.3): installers, portable and server zips, SHA256SUMS, release notes, the multi-arch server
# image on GHCR, and the public releases repository content (BRIEF §19.4).
on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
tag:
description: "Existing tag to (re)publish, e.g. v0.2.0"
required: true
permissions:
contents: write
packages: write
concurrency:
group: release-${{ github.event.inputs.tag || github.ref_name }}
cancel-in-progress: false
env:
DOTNET_NOLOGO: "1"
DOTNET_CLI_TELEMETRY_OPTOUT: "1"
TOOLS: src/Titano.Tools/bin/Release/net10.0/Titano.Tools.dll
# Public repository that receives releases (BRIEF §19.4). Override with the RELEASES_REPO repository variable.
RELEASES_REPO: ${{ vars.RELEASES_REPO || format('{0}/titano-releases', github.repository_owner) }}
jobs:
version:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.v.outputs.tag }}
version: ${{ steps.v.outputs.version }}
prerelease: ${{ steps.v.outputs.prerelease }}
steps:
- id: v
env:
TAG: ${{ github.event.inputs.tag || github.ref_name }}
run: |
if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
echo "::error title=Release::Tag '$TAG' is not vMAJOR.MINOR.PATCH or vMAJOR.MINOR.PATCH-PRERELEASE"
exit 1
fi
version="${TAG#v}"
{
echo "tag=$TAG"
echo "version=$version"
if [[ "$version" == *-* ]]; then echo "prerelease=true"; else echo "prerelease=false"; fi
} >> "$GITHUB_OUTPUT"
windows:
needs: version
runs-on: windows-latest
defaults:
run:
shell: bash
env:
VERSION: ${{ needs.version.outputs.version }}
# Secrets cannot appear in step conditions: expose only whether signing is configured.
HAS_SIGNING: ${{ secrets.SIGN_PFX_BASE64 != '' }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.version.outputs.tag }}
fetch-depth: 0
- uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Build and test
run: |
dotnet build Titano.slnx -c Release -p:TitanoVersion="$VERSION"
for t in Core Data Server Core.Windows App; do
dotnet run --project "tests/Titano.$t.Tests" -c Release --no-build -- --junit "out/junit/$t.xml"
done
- name: Screenshots for the public README
continue-on-error: true
run: |
for exe in src/Titano.App/bin/Release/net10.0-windows/Titano.exe src/Titano.Uploader/bin/Release/net10.0-windows/Titano.Uploader.exe; do
"$exe" --capture out/screenshots &
wait $! || echo "::warning title=Screenshots::$(basename "$exe") --capture exited with $?"
done
ls out/screenshots
- name: Publish self-contained programs
run: |
common="-c Release -r win-x64 --self-contained -p:TitanoVersion=$VERSION -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=none"
dotnet publish src/Titano.App/Titano.App.csproj $common -p:PublishReadyToRun=true -o out/publish/app
dotnet publish src/Titano.Uploader/Titano.Uploader.csproj $common -p:PublishReadyToRun=true -o out/publish/uploader
dotnet publish src/Titano.Server/Titano.Server.csproj $common -o out/publish/server
dotnet publish src/Titano.Setup/Titano.Setup.csproj $common -p:PublishReadyToRun=true -o out/publish/setup
- name: Sign binaries
if: env.HAS_SIGNING == 'true'
env:
SIGN_PFX: ${{ secrets.SIGN_PFX_BASE64 }}
SIGN_PASSWORD: ${{ secrets.SIGN_PASSWORD }}
shell: pwsh
run: |
$pfx = Join-Path $env:RUNNER_TEMP "sign.pfx"
[IO.File]::WriteAllBytes($pfx, [Convert]::FromBase64String($env:SIGN_PFX))
try {
$signtool = Get-ChildItem "${env:ProgramFiles(x86)}\Windows Kits\10\bin\*\x64\signtool.exe" | Sort-Object FullName -Descending | Select-Object -First 1
if (-not $signtool) { throw "signtool.exe not found in the Windows SDK" }
Get-ChildItem out/publish -Recurse -Include *.exe | ForEach-Object {
& $signtool.FullName sign /fd SHA256 /f $pfx /p $env:SIGN_PASSWORD /tr http://timestamp.digicert.com /td SHA256 $_.FullName
if ($LASTEXITCODE -ne 0) { throw "signtool failed for $($_.FullName)" }
}
} finally {
Remove-Item $pfx -ErrorAction SilentlyContinue
}
- name: Package installers and archives
run: |
mkdir -p out/release
dotnet "$TOOLS" pack-installer --setup out/publish/setup/Titano.Setup.exe --product Titano \
--component "Titano=out/publish/app" --component "Uploader=out/publish/uploader" --component "Server=out/publish/server" \
--version "$VERSION" --out "out/release/Titano-Setup-$VERSION.exe"
dotnet "$TOOLS" pack-installer --setup out/publish/setup/Titano.Setup.exe --product "Titano Uploader" \
--component "Uploader=out/publish/uploader" --version "$VERSION" --out "out/release/Titano-Uploader-Setup-$VERSION.exe"
(cd out/publish/server && 7z a -tzip "../../release/Titano-Server-win-x64-$VERSION.zip" . > /dev/null)
# The portable build keeps its data next to Titano.exe because of portable.txt (never inside the installer).
cp -R out/publish/app out/portable
printf 'Titano portable mode: settings, index and logs are kept in the data folder next to Titano.exe.\r\n' > out/portable/portable.txt
(cd out/portable && 7z a -tzip "../release/Titano-win-x64-portable-$VERSION.zip" . > /dev/null)
ls -l out/release
- name: Sign installers
if: env.HAS_SIGNING == 'true'
env:
SIGN_PFX: ${{ secrets.SIGN_PFX_BASE64 }}
SIGN_PASSWORD: ${{ secrets.SIGN_PASSWORD }}
shell: pwsh
run: |
$pfx = Join-Path $env:RUNNER_TEMP "sign.pfx"
[IO.File]::WriteAllBytes($pfx, [Convert]::FromBase64String($env:SIGN_PFX))
try {
$signtool = Get-ChildItem "${env:ProgramFiles(x86)}\Windows Kits\10\bin\*\x64\signtool.exe" | Sort-Object FullName -Descending | Select-Object -First 1
Get-ChildItem out/release -Filter *.exe | ForEach-Object {
& $signtool.FullName sign /fd SHA256 /f $pfx /p $env:SIGN_PASSWORD /tr http://timestamp.digicert.com /td SHA256 $_.FullName
if ($LASTEXITCODE -ne 0) { throw "signtool failed for $($_.FullName)" }
}
} finally {
Remove-Item $pfx -ErrorAction SilentlyContinue
}
- name: Unsigned build notice
if: env.HAS_SIGNING != 'true'
run: echo "::notice title=Signing::SIGN_PFX_BASE64 is not set; the installers are unsigned."
- name: Release notes
env:
TAG: ${{ needs.version.outputs.tag }}
run: |
previous="$(git describe --tags --abbrev=0 "$TAG^" 2>/dev/null || true)"
range="${previous:+$previous..}$TAG"
git log --no-merges --format='%h%x09%s' "$range" | dotnet "$TOOLS" changelog --title "Titano $VERSION" --out out/release-notes.md
cat out/release-notes.md
- uses: actions/upload-artifact@v4
with:
name: release-windows
if-no-files-found: error
path: |
out/release/
out/release-notes.md
out/screenshots/
docker:
needs: version
runs-on: ubuntu-latest
outputs:
image: ${{ steps.image.outputs.name }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.version.outputs.tag }}
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Image name
id: image
run: echo "name=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/titano-server" >> "$GITHUB_OUTPUT"
- uses: docker/build-push-action@v6
with:
context: .
file: deploy/docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args: TITANO_VERSION=${{ needs.version.outputs.version }}
tags: |
${{ steps.image.outputs.name }}:${{ needs.version.outputs.version }}
${{ needs.version.outputs.prerelease == 'false' && format('{0}:latest', steps.image.outputs.name) || '' }}
cache-from: type=gha
cache-to: type=gha,mode=max
publish:
needs: [version, windows, docker]
runs-on: ubuntu-latest
env:
TAG: ${{ needs.version.outputs.tag }}
VERSION: ${{ needs.version.outputs.version }}
PRERELEASE: ${{ needs.version.outputs.prerelease }}
IMAGE: ${{ needs.docker.outputs.image }}
HAS_RELEASES_TOKEN: ${{ secrets.RELEASES_TOKEN != '' }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.version.outputs.tag }}
- uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- uses: actions/download-artifact@v4
with:
name: release-windows
path: out
- name: Checksums
working-directory: out/release
run: |
rm -f SHA256SUMS
sha256sum -- * > "$RUNNER_TEMP/SHA256SUMS"
mv "$RUNNER_TEMP/SHA256SUMS" SHA256SUMS
cat SHA256SUMS
- name: Release target
id: target
run: |
if [ "$HAS_RELEASES_TOKEN" = "true" ]; then
echo "repo=$RELEASES_REPO" >> "$GITHUB_OUTPUT"
else
echo "repo=$GITHUB_REPOSITORY" >> "$GITHUB_OUTPUT"
echo "::notice title=Release::RELEASES_TOKEN is not set: publishing to $GITHUB_REPOSITORY instead of $RELEASES_REPO (clients only see releases of $RELEASES_REPO)."
fi
- name: Update the public releases repository
if: env.HAS_RELEASES_TOKEN == 'true'
env:
GH_TOKEN: ${{ secrets.RELEASES_TOKEN }}
run: |
owner="${RELEASES_REPO%%/*}"
branch="$(gh api "repos/$RELEASES_REPO" --jq .default_branch)"
git clone --depth 1 "https://x-access-token:${GH_TOKEN}@github.com/${RELEASES_REPO}.git" public
git -C public checkout -B "$branch"
cp -R deploy/releases-repo/. public/
mkdir -p public/unraid public/docker public/screenshots
cp deploy/unraid/titano.xml public/unraid/titano.xml
cp deploy/docker/docker-compose.yml deploy/docker/.env.example public/docker/
dotnet run --project src/Titano.Tools -c Release -- make-icon --out "$RUNNER_TEMP/icons"
cp "$RUNNER_TEMP/icons/titano-server-256.png" public/unraid/titano-server.png
rm -rf public/i18n
cp -R i18n public/i18n
cp out/release/SHA256SUMS public/SHA256SUMS
for shot in library jobs settings-rendering server uploader-queue; do
if [ -f "out/screenshots/$shot-dark.png" ]; then cp "out/screenshots/$shot-dark.png" public/screenshots/; fi
done
# Links in the published files follow the configured repository and image owner.
find public -path public/.git -prune -o -type f \( -name '*.md' -o -name '*.yml' -o -name '*.xml' \) -print0 |
xargs -0 -r sed -i -e "s#alby96/titano-releases#${RELEASES_REPO}#g" -e "s#ghcr.io/alby96/#ghcr.io/${owner,,}/#g"
cd public
git config user.name "titano-release"
git config user.email "titano-release@users.noreply.github.com"
git add -A
if git diff --cached --quiet; then
echo "Public repository already up to date."
else
git commit -q -m "chore: update for $TAG"
git push origin "HEAD:$branch"
fi
- name: GitHub release
env:
GH_TOKEN: ${{ env.HAS_RELEASES_TOKEN == 'true' && secrets.RELEASES_TOKEN || secrets.GITHUB_TOKEN }}
TARGET: ${{ steps.target.outputs.repo }}
run: |
if gh release view "$TAG" --repo "$TARGET" > /dev/null 2>&1; then
gh release upload "$TAG" out/release/* --repo "$TARGET" --clobber
gh release edit "$TAG" --repo "$TARGET" --title "Titano $VERSION" --notes-file out/release-notes.md --prerelease="$PRERELEASE"
else
gh release create "$TAG" out/release/* --repo "$TARGET" --title "Titano $VERSION" --notes-file out/release-notes.md --prerelease="$PRERELEASE"
fi
- name: Summary
env:
TARGET: ${{ steps.target.outputs.repo }}
run: |
{
echo "## Titano $VERSION"
echo "- Release: https://github.com/$TARGET/releases/tag/$TAG"
echo "- Image: \`$IMAGE:$VERSION\`$([ "$PRERELEASE" = "false" ] && echo " and \`:latest\`")"
echo "- GHCR packages are private when first pushed and GitHub has no API to change that: once, open the"
echo " package settings of \`titano-server\` and set its visibility to **Public** (BRIEF §19.4)."
echo
echo '```'
cat out/release/SHA256SUMS
echo '```'
} >> "$GITHUB_STEP_SUMMARY"