Skip to content

Bump TerminalGuiVersion to 2.4.18-develop.5 #261

Bump TerminalGuiVersion to 2.4.18-develop.5

Bump TerminalGuiVersion to 2.4.18-develop.5 #261

Workflow file for this run

name: Release
# Publishes Terminal.Gui.Editor to NuGet.
#
# Triggers:
# 1. Push of a `v*` tag (canonical release path, e.g. v2.5.3)
# → Version = tag with leading `v` stripped.
# 2. Push to `develop` (rolling pre-release)
# → Version computed by GitVersion from git history + GitVersion.yml,
# e.g. 2.5.3-develop.7 (latest reachable tag + Patch, develop label).
#
# No version is stored in the repo; tags are the source of truth.
# The computed value is injected into builds via `-p:Version=...`.
on:
push:
tags: ['v*']
branches: [develop]
permissions:
contents: write
concurrency:
group: release
cancel-in-progress: false
jobs:
resolve-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.v.outputs.version }}
steps:
- uses: actions/checkout@v5
with:
# GitVersion needs full history + tags.
fetch-depth: 0
- name: Install GitVersion
if: github.ref_type != 'tag'
uses: gittools/actions/gitversion/setup@v4.5.0
with:
versionSpec: '6.x'
- name: Run GitVersion
if: github.ref_type != 'tag'
id: gitversion
# GitVersion.yml at the repo root is picked up automatically.
uses: gittools/actions/gitversion/execute@v4.5.0
- name: Compute version
id: v
shell: bash
run: |
if [ "${{ github.ref_type }}" = "tag" ]; then
# Tag form: v2.5.3 → 2.5.3 (the tag is canonical; no GitVersion needed)
VERSION="${GITHUB_REF_NAME#v}"
elif [ "${{ github.ref }}" = "refs/heads/develop" ]; then
# GitVersion: latest reachable tag + Patch, develop label, commit count.
VERSION="${{ steps.gitversion.outputs.SemVer }}"
else
echo "::error::Unsupported trigger: event=${{ github.event_name }} ref=${{ github.ref }}"
exit 1
fi
if [ -z "$VERSION" ]; then
echo "::error::Could not resolve version."
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "## Release" >> "$GITHUB_STEP_SUMMARY"
echo "- version: \`$VERSION\`" >> "$GITHUB_STEP_SUMMARY"
echo "- trigger: \`${{ github.event_name }}\` (\`${{ github.ref }}\`)" >> "$GITHUB_STEP_SUMMARY"
build-and-test:
needs: resolve-version
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
rid: linux-x64
- os: macos-latest
rid: osx-arm64
- os: windows-latest
rid: win-x64
- os: windows-latest
rid: win-arm64
runs-on: ${{ matrix.os }}
env:
VERSION: ${{ needs.resolve-version.outputs.version }}
# Tells Terminal.Gui drivers to skip real-terminal probing/IO
# so the ANSI driver runs on Windows runners without a TTY.
DisableRealDriverIO: "1"
steps:
- uses: actions/checkout@v5
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
dotnet-quality: 'preview'
- name: Restore
run: dotnet restore Terminal.Gui.Editor.slnx
- name: Build
run: dotnet build Terminal.Gui.Editor.slnx --no-restore -c Release -p:Version=${{ env.VERSION }}
- name: Terminal.Gui.Editor.Tests
run: dotnet run --project tests/Terminal.Gui.Editor.Tests --no-build -c Release
- name: Terminal.Gui.Editor.IntegrationTests
run: dotnet run --project tests/Terminal.Gui.Editor.IntegrationTests --no-build -c Release
- name: Publish ted AOT
run: >
dotnet publish examples/ted -c Release
-r ${{ matrix.rid }}
--self-contained
-p:PublishAot=true
-p:Version=${{ env.VERSION }}
-o publish/${{ matrix.rid }}
- name: Upload ted artifact
uses: actions/upload-artifact@v4
with:
name: ted-${{ matrix.rid }}
path: publish/${{ matrix.rid }}/
retention-days: 30
pack-and-publish:
needs: [resolve-version, build-and-test]
runs-on: ubuntu-latest
env:
VERSION: ${{ needs.resolve-version.outputs.version }}
steps:
- uses: actions/checkout@v5
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
dotnet-quality: 'preview'
- name: Pack Terminal.Gui.Editor
run: dotnet pack src/Terminal.Gui.Editor -c Release -p:Version=${{ env.VERSION }} -o packages/
- name: Upload packages
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: packages/*.nupkg
retention-days: 30
- name: Push to NuGet
run: >
dotnet nuget push packages/*.nupkg
--api-key ${{ secrets.NUGET_API_KEY }}
--source https://api.nuget.org/v3/index.json
--skip-duplicate
# Attach ted AOT binaries to the GitHub Release (tag pushes only).
# The Release is created by finalize-release.yml before the tag push triggers this workflow.
release-assets:
if: github.ref_type == 'tag'
needs: [resolve-version, build-and-test]
runs-on: ubuntu-latest
env:
VERSION: ${{ needs.resolve-version.outputs.version }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
steps:
- uses: actions/checkout@v5
- name: Download all ted artifacts
uses: actions/download-artifact@v4
with:
pattern: ted-*
path: artifacts/
- name: Package release archives
shell: bash
run: |
set -euo pipefail
mkdir -p dist
package_unix() {
local rid="$1"
local src="artifacts/ted-${rid}"
if [ ! -d "$src" ]; then
echo "::warning::No artifact for ${rid}, skipping"
return 0
fi
chmod +x "$src/ted" 2>/dev/null || true
tar -czf "dist/ted-${VERSION}-${rid}.tar.gz" -C "$src" .
echo "Created dist/ted-${VERSION}-${rid}.tar.gz"
}
package_windows() {
local rid="$1"
local src="artifacts/ted-${rid}"
if [ ! -d "$src" ]; then
echo "::warning::No artifact for ${rid}, skipping"
return 0
fi
(cd "$src" && zip -r "../../dist/ted-${VERSION}-${rid}.zip" .)
echo "Created dist/ted-${VERSION}-${rid}.zip"
}
package_unix osx-arm64
package_unix linux-x64
package_windows win-x64
package_windows win-arm64
ls -la dist/
- name: Upload to GitHub Release
shell: bash
run: |
TAG="${GITHUB_REF_NAME}"
if gh release view "$TAG" >/dev/null 2>&1; then
gh release upload "$TAG" dist/* --clobber
else
echo "::warning::Release $TAG not found; creating one."
gh release create "$TAG" --title "ted $TAG" --generate-notes dist/*
fi
# Notify downstream repos (tui-cs/clet) so they can rebuild against the new Editor version.
# Uses a PAT stored as CLET_DISPATCH_TOKEN with `repo` scope on tui-cs/clet.
notify-downstream:
needs: [resolve-version, pack-and-publish]
runs-on: ubuntu-latest
continue-on-error: true # Non-blocking: missing secret shouldn't fail the release
env:
VERSION: ${{ needs.resolve-version.outputs.version }}
CLET_DISPATCH_TOKEN: ${{ secrets.CLET_DISPATCH_TOKEN }}
steps:
- name: Skip dispatch (no token configured)
if: ${{ env.CLET_DISPATCH_TOKEN == '' }}
run: echo "::warning::CLET_DISPATCH_TOKEN is not set; skipping downstream dispatch."
- name: Wait for NuGet flat-container to index the version
if: ${{ env.CLET_DISPATCH_TOKEN != '' }}
run: |
VER="${{ env.VERSION }}"
for i in $(seq 1 60); do
if curl -fsS https://api.nuget.org/v3-flatcontainer/terminal.gui.editor/index.json \
| jq -r '.versions[]' | grep -qx "$VER"; then
echo "Indexed on flat-container: $VER (after $((i*10))s)"
exit 0
fi
echo "Waiting for $VER on NuGet flat-container ($i/60, 10s each)..."
sleep 10
done
echo "::error::Timed out after 10min waiting for $VER on flat-container"
exit 1
- name: Dispatch to tui-cs/clet
if: ${{ env.CLET_DISPATCH_TOKEN != '' }}
uses: actions/github-script@v7
with:
github-token: ${{ env.CLET_DISPATCH_TOKEN }}
script: |
const ref = context.ref;
const isMain = ref === 'refs/heads/main' || ref.startsWith('refs/tags/v');
const isDevelop = ref === 'refs/heads/develop';
const eventType = isMain ? 'editor-main-published' : isDevelop ? 'editor-develop-published' : null;
if (!eventType) {
console.log(`Skipping downstream dispatch for ref=${ref}`);
return;
}
await github.rest.repos.createDispatchEvent({
owner: 'tui-cs',
repo: 'clet',
event_type: eventType,
client_payload: { tge_version: process.env.VERSION }
});
console.log(`Dispatched ${eventType} with tge_version=${process.env.VERSION} to tui-cs/clet`);
notify-failure:
needs: [resolve-version, build-and-test, pack-and-publish]
if: failure()
runs-on: ubuntu-latest
permissions:
issues: write
env:
VERSION: ${{ needs.resolve-version.outputs.version }}
steps:
- uses: actions/github-script@v7
with:
script: |
await github.rest.issues.create ({
owner: context.repo.owner,
repo: context.repo.repo,
title: `Release v${process.env.VERSION} failed`,
body: `The release workflow for \`${process.env.VERSION}\` failed.\n\nSee [workflow run](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}) for details.`,
labels: ['release-failure']
});