Merge pull request 'Migrate desktop app to Avalonia and publish cross-platform releases' (#1) from codex/avalonia-cross-platform into master
Build and Release / Publish Windows, Linux and macOS (push) Successful in 3m24s

Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
biss committed 2026-07-19 09:50:00 +08:00
commit 16f08cbada
17 files changed
+1048 -37

No files matched your search

+47 -14
View File
@@ -11,7 +11,7 @@ permissions:
jobs:
release:
name: Publish Windows x64
name: Publish Windows, Linux and macOS
runs-on: ubuntu-latest
steps:
@@ -23,7 +23,8 @@ jobs:
with:
dotnet-version: "8.0.x"
- name: Build Windows executable
- name: Read release metadata
id: metadata
shell: bash
env:
TAG_NAME: ${{ gitea.ref_name }}
@@ -36,20 +37,51 @@ jobs:
exit 1
fi
dotnet publish ./kcsj.csproj \
--configuration Release \
--runtime win-x64 \
--self-contained true \
--output ./publish \
-p:EnableWindowsTargeting=true \
-p:PublishSingleFile=true \
-p:EnableCompressionInSingleFile=true \
-p:IncludeNativeLibrariesForSelfExtract=true \
-p:DebugType=None \
-p:Version="${version}"
prerelease=false
if [[ "${version}" == *-* ]]; then
prerelease=true
fi
echo "version=${version}" >> "${GITEA_OUTPUT}"
echo "prerelease=${prerelease}" >> "${GITEA_OUTPUT}"
- name: Publish all desktop platforms
shell: bash
env:
TAG_NAME: ${{ gitea.ref_name }}
VERSION: ${{ steps.metadata.outputs.version }}
run: |
set -euo pipefail
runtimes=(win-x64 linux-x64 osx-x64)
mkdir -p ./dist
mv ./publish/kcsj.exe "./dist/kcsj-${TAG_NAME}-win-x64.exe"
for runtime in "${runtimes[@]}"; do
publish_dir="./publish/${runtime}"
dotnet publish ./kcsj.csproj \
--configuration Release \
--runtime "${runtime}" \
--self-contained true \
--output "${publish_dir}" \
-p:PublishSingleFile=true \
-p:EnableCompressionInSingleFile=true \
-p:IncludeNativeLibrariesForSelfExtract=true \
-p:DebugType=None \
-p:Version="${VERSION}"
if [[ "${runtime}" == "win-x64" ]]; then
cp "${publish_dir}/kcsj.exe" "./dist/kcsj-${TAG_NAME}-${runtime}.exe"
else
tar -czf "./dist/kcsj-${TAG_NAME}-${runtime}.tar.gz" \
-C "${publish_dir}" .
fi
done
(
cd ./dist
sha256sum kcsj-* > SHA256SUMS.txt
)
# Gitea's release action is written in Go and is compiled by the runner.
- name: Set up Go for the release action
@@ -61,6 +93,7 @@ jobs:
uses: https://gitea.com/actions/release-action@main
with:
title: ${{ gitea.ref_name }}
pre_release: ${{ steps.metadata.outputs.prerelease }}
files: |-
dist/*
api_key: ${{ secrets.GITEA_TOKEN }}
+8
View File
@@ -0,0 +1,8 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="kcsj.App"
RequestedThemeVariant="Default">
<Application.Styles>
<FluentTheme />
</Application.Styles>
</Application>
+24
View File
@@ -0,0 +1,24 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using kcsj.Views;
namespace kcsj;
public partial class App : Application
{
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
desktop.MainWindow = new MainWindow();
}
base.OnFrameworkInitializationCompleted();
}
}
Loaded 3 of 17 files, more files were not shown because too many files have changed in this diff. Show more