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
This commit is contained in:
11 files changed
+588
-59
No files matched your search
@@ -64,10 +64,9 @@ jobs:
|
||||
if: runner.os == 'Windows'
|
||||
run: dotnet format whitespace Titano.slnx --verify-no-changes
|
||||
|
||||
# Missing samples become "RAW fixture missing" warning annotations; the tests that need them skip.
|
||||
- name: Fetch CC0 fixtures
|
||||
continue-on-error: true
|
||||
run: |
|
||||
if dotnet "$TOOLS" --help | grep -q '^ fixtures'; then dotnet "$TOOLS" fixtures; fi
|
||||
run: dotnet "$TOOLS" fixtures --allow-missing
|
||||
|
||||
- name: Test · Core
|
||||
run: dotnet run --project tests/Titano.Core.Tests -c Release --no-build -- --junit out/junit/core.xml
|
||||
|
||||
+143
-45
@@ -1,5 +1,8 @@
|
||||
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*"]
|
||||
@@ -13,10 +16,15 @@ 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"
|
||||
# Public repository that receives releases (BRIEF §19.4). Override with the RELEASES_REPO variable.
|
||||
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:
|
||||
@@ -28,12 +36,19 @@ jobs:
|
||||
prerelease: ${{ steps.v.outputs.prerelease }}
|
||||
steps:
|
||||
- id: v
|
||||
env:
|
||||
TAG: ${{ github.event.inputs.tag || github.ref_name }}
|
||||
run: |
|
||||
tag="${{ github.event.inputs.tag || github.ref_name }}"
|
||||
version="${tag#v}"
|
||||
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
||||
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||
if [[ "$version" == *-* ]]; then echo "prerelease=true" >> "$GITHUB_OUTPUT"; else echo "prerelease=false" >> "$GITHUB_OUTPUT"; fi
|
||||
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
|
||||
@@ -43,6 +58,8 @@ jobs:
|
||||
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:
|
||||
@@ -59,6 +76,15 @@ jobs:
|
||||
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"
|
||||
@@ -68,7 +94,7 @@ jobs:
|
||||
dotnet publish src/Titano.Setup/Titano.Setup.csproj $common -p:PublishReadyToRun=true -o out/publish/setup
|
||||
|
||||
- name: Sign binaries
|
||||
if: env.SIGN_PFX != ''
|
||||
if: env.HAS_SIGNING == 'true'
|
||||
env:
|
||||
SIGN_PFX: ${{ secrets.SIGN_PFX_BASE64 }}
|
||||
SIGN_PASSWORD: ${{ secrets.SIGN_PASSWORD }}
|
||||
@@ -76,27 +102,34 @@ jobs:
|
||||
run: |
|
||||
$pfx = Join-Path $env:RUNNER_TEMP "sign.pfx"
|
||||
[IO.File]::WriteAllBytes($pfx, [Convert]::FromBase64String($env:SIGN_PFX))
|
||||
$signtool = Get-ChildItem "${env:ProgramFiles(x86)}\Windows Kits\10\bin\*\x64\signtool.exe" | Sort-Object FullName -Descending | Select-Object -First 1
|
||||
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)" }
|
||||
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
|
||||
}
|
||||
Remove-Item $pfx
|
||||
|
||||
- name: Package installers and archives
|
||||
run: |
|
||||
mkdir -p out/release
|
||||
tools=src/Titano.Tools/bin/Release/net10.0/Titano.Tools.dll
|
||||
dotnet "$tools" pack-installer --setup out/publish/setup/Titano.Setup.exe --product Titano \
|
||||
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" \
|
||||
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)
|
||||
(cd out/publish/app && 7z a -tzip "../../release/Titano-win-x64-portable-$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.SIGN_PFX != ''
|
||||
if: env.HAS_SIGNING == 'true'
|
||||
env:
|
||||
SIGN_PFX: ${{ secrets.SIGN_PFX_BASE64 }}
|
||||
SIGN_PASSWORD: ${{ secrets.SIGN_PASSWORD }}
|
||||
@@ -104,27 +137,43 @@ jobs:
|
||||
run: |
|
||||
$pfx = Join-Path $env:RUNNER_TEMP "sign.pfx"
|
||||
[IO.File]::WriteAllBytes($pfx, [Convert]::FromBase64String($env:SIGN_PFX))
|
||||
$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 }
|
||||
Remove-Item $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: |
|
||||
tag="${{ needs.version.outputs.tag }}"
|
||||
previous="$(git describe --tags --abbrev=0 "$tag^" 2>/dev/null || true)"
|
||||
range="${previous:+$previous..}$tag"
|
||||
git log --format='%h%x09%s' "$range" | dotnet src/Titano.Tools/bin/Release/net10.0/Titano.Tools.dll changelog --title "Titano ${{ needs.version.outputs.version }}" --out out/release-notes.md
|
||||
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:
|
||||
@@ -158,49 +207,98 @@ jobs:
|
||||
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: |
|
||||
cd out/release
|
||||
sha256sum * > SHA256SUMS
|
||||
rm -f SHA256SUMS
|
||||
sha256sum -- * > "$RUNNER_TEMP/SHA256SUMS"
|
||||
mv "$RUNNER_TEMP/SHA256SUMS" SHA256SUMS
|
||||
cat SHA256SUMS
|
||||
|
||||
- name: Create release in the public releases repository
|
||||
if: env.RELEASES_TOKEN != ''
|
||||
- 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:
|
||||
RELEASES_TOKEN: ${{ secrets.RELEASES_TOKEN }}
|
||||
GH_TOKEN: ${{ secrets.RELEASES_TOKEN }}
|
||||
run: |
|
||||
flags=""
|
||||
if [ "${{ needs.version.outputs.prerelease }}" = "true" ]; then flags="--prerelease"; fi
|
||||
gh release create "$TAG" out/release/* --repo "$RELEASES_REPO" --title "Titano $VERSION" --notes-file out/release-notes.md $flags
|
||||
# Keep the Unraid template, icon and EULA in the public repository up to date.
|
||||
git clone --depth 1 "https://x-access-token:${RELEASES_TOKEN}@github.com/${RELEASES_REPO}.git" public
|
||||
mkdir -p public/unraid
|
||||
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
|
||||
if [ -f docs/legal/EULA.md ]; then cp docs/legal/EULA.md public/EULA.md; fi
|
||||
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
|
||||
git diff --cached --quiet || git commit -m "chore: update Unraid template and assets for $TAG"
|
||||
git push
|
||||
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: Create release in this repository (no RELEASES_TOKEN configured)
|
||||
if: env.RELEASES_TOKEN == ''
|
||||
- name: GitHub release
|
||||
env:
|
||||
RELEASES_TOKEN: ${{ secrets.RELEASES_TOKEN }}
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GH_TOKEN: ${{ env.HAS_RELEASES_TOKEN == 'true' && secrets.RELEASES_TOKEN || secrets.GITHUB_TOKEN }}
|
||||
TARGET: ${{ steps.target.outputs.repo }}
|
||||
run: |
|
||||
flags=""
|
||||
if [ "${{ needs.version.outputs.prerelease }}" = "true" ]; then flags="--prerelease"; fi
|
||||
gh release create "$TAG" out/release/* --repo "$GITHUB_REPOSITORY" --title "Titano $VERSION" --notes-file out/release-notes.md $flags
|
||||
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"
|
||||
Reference in new issue
Block a user