Migrate desktop app to Avalonia and publish cross-platform releases
Build and Release / Publish Windows, Linux and macOS (push) Successful in 3m7s
Build and Release / Publish Windows, Linux and macOS (push) Successful in 3m7s
This commit is contained in:
1 parent
864feaf317
commit
f61e298871
17 files changed
+1048
-37
No files matched your search
@@ -11,7 +11,7 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
name: Publish Windows x64
|
name: Publish Windows, Linux and macOS
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -23,7 +23,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
dotnet-version: "8.0.x"
|
dotnet-version: "8.0.x"
|
||||||
|
|
||||||
- name: Build Windows executable
|
- name: Read release metadata
|
||||||
|
id: metadata
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
TAG_NAME: ${{ gitea.ref_name }}
|
TAG_NAME: ${{ gitea.ref_name }}
|
||||||
@@ -36,20 +37,51 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dotnet publish ./kcsj.csproj \
|
prerelease=false
|
||||||
--configuration Release \
|
if [[ "${version}" == *-* ]]; then
|
||||||
--runtime win-x64 \
|
prerelease=true
|
||||||
--self-contained true \
|
fi
|
||||||
--output ./publish \
|
|
||||||
-p:EnableWindowsTargeting=true \
|
|
||||||
-p:PublishSingleFile=true \
|
|
||||||
-p:EnableCompressionInSingleFile=true \
|
|
||||||
-p:IncludeNativeLibrariesForSelfExtract=true \
|
|
||||||
-p:DebugType=None \
|
|
||||||
-p:Version="${version}"
|
|
||||||
|
|
||||||
|
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
|
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.
|
# Gitea's release action is written in Go and is compiled by the runner.
|
||||||
- name: Set up Go for the release action
|
- name: Set up Go for the release action
|
||||||
@@ -61,6 +93,7 @@ jobs:
|
|||||||
uses: https://gitea.com/actions/release-action@main
|
uses: https://gitea.com/actions/release-action@main
|
||||||
with:
|
with:
|
||||||
title: ${{ gitea.ref_name }}
|
title: ${{ gitea.ref_name }}
|
||||||
|
pre_release: ${{ steps.metadata.outputs.prerelease }}
|
||||||
files: |-
|
files: |-
|
||||||
dist/*
|
dist/*
|
||||||
api_key: ${{ secrets.GITEA_TOKEN }}
|
api_key: ${{ secrets.GITEA_TOKEN }}
|
||||||
@@ -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>
|
||||||
@@ -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
Reference in new issue
Block a user