mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-06-06 09:58:18 +08:00
24bd21936f
* create-dmg * create-dmg-update * Potential fix for pull request finding OK Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
399 lines
13 KiB
YAML
399 lines
13 KiB
YAML
name: Publish Demo
|
||
|
||
on:
|
||
workflow_dispatch:
|
||
inputs:
|
||
win-x64:
|
||
description: 'Windows x64'
|
||
default: false
|
||
type: boolean
|
||
win-x64-aot:
|
||
description: 'Windows x64 AOT'
|
||
default: false
|
||
type: boolean
|
||
linux-x64:
|
||
description: 'Linux x64'
|
||
default: false
|
||
type: boolean
|
||
linux-x64-aot:
|
||
description: 'Linux x64 AOT'
|
||
default: false
|
||
type: boolean
|
||
drm-linux-x64:
|
||
description: 'DRM Linux x64'
|
||
default: false
|
||
type: boolean
|
||
drm-linux-x64-aot:
|
||
description: 'DRM Linux x64 AOT'
|
||
default: false
|
||
type: boolean
|
||
osx-arm64:
|
||
description: 'macOS arm64'
|
||
default: false
|
||
type: boolean
|
||
osx-arm64-aot:
|
||
description: 'macOS arm64 AOT'
|
||
default: false
|
||
type: boolean
|
||
osx-x64:
|
||
description: 'macOS Intel x64'
|
||
default: false
|
||
type: boolean
|
||
osx-x64-aot:
|
||
description: 'macOS Intel x64 AOT'
|
||
default: false
|
||
type: boolean
|
||
android-arm64:
|
||
description: 'Android arm64'
|
||
default: false
|
||
type: boolean
|
||
workflow_call:
|
||
inputs:
|
||
win-x64:
|
||
type: boolean
|
||
default: true
|
||
win-x64-aot:
|
||
type: boolean
|
||
default: true
|
||
linux-x64:
|
||
type: boolean
|
||
default: true
|
||
linux-x64-aot:
|
||
type: boolean
|
||
default: true
|
||
drm-linux-x64:
|
||
type: boolean
|
||
default: true
|
||
drm-linux-x64-aot:
|
||
type: boolean
|
||
default: true
|
||
osx-arm64:
|
||
type: boolean
|
||
default: true
|
||
osx-arm64-aot:
|
||
type: boolean
|
||
default: true
|
||
osx-x64:
|
||
type: boolean
|
||
default: true
|
||
osx-x64-aot:
|
||
type: boolean
|
||
default: true
|
||
android-arm64:
|
||
type: boolean
|
||
default: true
|
||
|
||
# SDK 渠道与各作业的 TargetFramework 对应:
|
||
# - net8.0(Semi.Avalonia.Demo.Desktop / Semi.Avalonia.Demo.Drm)→ DOTNET_SDK_VERSION_NET8
|
||
# - net10.0-android(Semi.Avalonia.Demo.Android)→ DOTNET_SDK_VERSION_NET10
|
||
env:
|
||
DOTNET_SDK_VERSION_NET8: '8.0.x'
|
||
DOTNET_SDK_VERSION_NET10: '10.0.x'
|
||
|
||
jobs:
|
||
win-x64:
|
||
if: ${{inputs.win-x64}}
|
||
runs-on: windows-latest
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v5
|
||
- name: Setup dotnet
|
||
uses: actions/setup-dotnet@v5
|
||
with:
|
||
dotnet-version: ${{ env.DOTNET_SDK_VERSION_NET8 }}
|
||
- name: Publish win-x64
|
||
run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r win-x64 -c Release -o publish --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true
|
||
- name: Upload a Build Artifact
|
||
uses: actions/upload-artifact@v4.6.2
|
||
with:
|
||
name: Semi.Avalonia.Demo.Desktop.win-x64
|
||
path: |
|
||
publish
|
||
!publish/*.pdb
|
||
|
||
win-x64-aot:
|
||
if: ${{inputs.win-x64-aot}}
|
||
runs-on: windows-latest
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v5
|
||
- name: Setup dotnet
|
||
uses: actions/setup-dotnet@v5
|
||
with:
|
||
dotnet-version: ${{ env.DOTNET_SDK_VERSION_NET8 }}
|
||
- name: Enable Native AOT in .csproj
|
||
run: sed -i 's#<!--<PublishAot>true</PublishAot>-->#<PublishAot>true</PublishAot>#' demo/Semi.Avalonia.Demo.Desktop/Semi.Avalonia.Demo.Desktop.csproj
|
||
- name: Publish win-x64 AOT
|
||
run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r win-x64 -c Release -o publish
|
||
- name: Upload a Build Artifact
|
||
uses: actions/upload-artifact@v4.6.2
|
||
with:
|
||
name: Semi.Avalonia.Demo.Desktop.win-x64.NativeAOT
|
||
path: |
|
||
publish
|
||
!publish/*.pdb
|
||
|
||
linux-x64:
|
||
if: ${{inputs.linux-x64}}
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v5
|
||
- name: Setup dotnet
|
||
uses: actions/setup-dotnet@v5
|
||
with:
|
||
dotnet-version: ${{ env.DOTNET_SDK_VERSION_NET8 }}
|
||
- name: Publish linux-x64
|
||
run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r linux-x64 -c Release -o publish --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true
|
||
- name: Upload a Build Artifact
|
||
uses: actions/upload-artifact@v4.6.2
|
||
with:
|
||
name: Semi.Avalonia.Demo.Desktop.linux-x64
|
||
path: |
|
||
publish
|
||
!publish/*.pdb
|
||
|
||
linux-x64-aot:
|
||
if: ${{inputs.linux-x64-aot}}
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v5
|
||
- name: Setup dotnet
|
||
uses: actions/setup-dotnet@v5
|
||
with:
|
||
dotnet-version: ${{ env.DOTNET_SDK_VERSION_NET8 }}
|
||
- name: Enable Native AOT in .csproj
|
||
run: sed -i 's#<!--<PublishAot>true</PublishAot>-->#<PublishAot>true</PublishAot>#' demo/Semi.Avalonia.Demo.Desktop/Semi.Avalonia.Demo.Desktop.csproj
|
||
- name: Publish linux-x64 AOT
|
||
run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r linux-x64 -c Release -o publish
|
||
- name: Upload a Build Artifact
|
||
uses: actions/upload-artifact@v4.6.2
|
||
with:
|
||
name: Semi.Avalonia.Demo.Desktop.linux-x64.NativeAOT
|
||
path: |
|
||
publish
|
||
!publish/*.pdb
|
||
|
||
drm-linux-x64:
|
||
if: ${{inputs.drm-linux-x64}}
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v5
|
||
- name: Setup dotnet
|
||
uses: actions/setup-dotnet@v5
|
||
with:
|
||
dotnet-version: ${{ env.DOTNET_SDK_VERSION_NET8 }}
|
||
- name: Publish linux-x64 DRM
|
||
run: dotnet publish demo/Semi.Avalonia.Demo.Drm -r linux-x64 -c Release -o publish --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true
|
||
- name: Upload a Build Artifact
|
||
uses: actions/upload-artifact@v4.6.2
|
||
with:
|
||
name: Semi.Avalonia.Demo.Drm.linux-x64
|
||
path: |
|
||
publish
|
||
!publish/*.pdb
|
||
|
||
drm-linux-x64-aot:
|
||
if: ${{inputs.drm-linux-x64-aot}}
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v5
|
||
- name: Setup dotnet
|
||
uses: actions/setup-dotnet@v5
|
||
with:
|
||
dotnet-version: ${{ env.DOTNET_SDK_VERSION_NET8 }}
|
||
- name: Enable Native AOT in .csproj
|
||
run: sed -i 's#<!--<PublishAot>true</PublishAot>-->#<PublishAot>true</PublishAot>#' demo/Semi.Avalonia.Demo.Drm/Semi.Avalonia.Demo.Drm.csproj
|
||
- name: Publish linux-x64 AOT
|
||
run: dotnet publish demo/Semi.Avalonia.Demo.Drm -r linux-x64 -c Release -o publish
|
||
- name: Upload a Build Artifact
|
||
uses: actions/upload-artifact@v4.6.2
|
||
with:
|
||
name: Semi.Avalonia.Demo.Drm.linux-x64.NativeAOT
|
||
path: |
|
||
publish
|
||
!publish/*.pdb
|
||
|
||
osx-arm64:
|
||
if: ${{inputs.osx-arm64}}
|
||
runs-on: macos-latest
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v5
|
||
|
||
- name: Setup dotnet
|
||
uses: actions/setup-dotnet@v5
|
||
with:
|
||
dotnet-version: ${{ env.DOTNET_SDK_VERSION_NET8 }}
|
||
|
||
- name: Publish osx-arm64
|
||
run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r osx-arm64 -c Release -o publish --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true
|
||
|
||
- name: Create .app bundle and DMG (create-dmg)
|
||
run: |
|
||
set -euo pipefail
|
||
APP_DIR="bundle/Semi.Avalonia.Demo.app"
|
||
MACOS_DIR="${APP_DIR}/Contents/MacOS"
|
||
mkdir -p "${MACOS_DIR}"
|
||
cp -R publish/. "${MACOS_DIR}/"
|
||
chmod +x "${MACOS_DIR}/Semi.Avalonia.Demo.Desktop"
|
||
cp publish/Info-macOS.plist "${APP_DIR}/Contents/Info.plist"
|
||
codesign --force --deep --sign - "${APP_DIR}"
|
||
mkdir -p dmg_stage
|
||
ditto "${APP_DIR}" "dmg_stage/Semi.Avalonia.Demo.app"
|
||
brew install create-dmg
|
||
rm -f Semi.Avalonia.Demo.Desktop.osx-arm64.dmg
|
||
create-dmg \
|
||
--volname "Semi Avalonia Demo" \
|
||
--window-pos 200 120 \
|
||
--window-size 640 400 \
|
||
--icon-size 100 \
|
||
--icon "Semi.Avalonia.Demo.app" 175 185 \
|
||
--hide-extension "Semi.Avalonia.Demo.app" \
|
||
--app-drop-link 455 185 \
|
||
--skip-jenkins \
|
||
"Semi.Avalonia.Demo.Desktop.osx-arm64.dmg" \
|
||
"dmg_stage"
|
||
|
||
- name: Upload a Build Artifact
|
||
uses: actions/upload-artifact@v4.6.2
|
||
with:
|
||
name: Semi.Avalonia.Demo.Desktop.osx-arm64
|
||
path: |
|
||
publish
|
||
!publish/*.pdb
|
||
|
||
- name: Upload macOS DMG
|
||
uses: actions/upload-artifact@v4.6.2
|
||
with:
|
||
name: Semi.Avalonia.Demo.Desktop.osx-arm64.dmg
|
||
path: Semi.Avalonia.Demo.Desktop.osx-arm64.dmg
|
||
|
||
osx-x64:
|
||
if: ${{inputs.osx-x64}}
|
||
runs-on: macos-latest
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v5
|
||
|
||
- name: Setup dotnet
|
||
uses: actions/setup-dotnet@v5
|
||
with:
|
||
dotnet-version: ${{ env.DOTNET_SDK_VERSION_NET8 }}
|
||
|
||
- name: Publish osx-x64
|
||
run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r osx-x64 -c Release -o publish --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true
|
||
|
||
- name: Create .app bundle and DMG (create-dmg)
|
||
run: |
|
||
set -euo pipefail
|
||
APP_DIR="bundle/Semi.Avalonia.Demo.app"
|
||
MACOS_DIR="${APP_DIR}/Contents/MacOS"
|
||
mkdir -p "${MACOS_DIR}"
|
||
cp -R publish/. "${MACOS_DIR}/"
|
||
chmod +x "${MACOS_DIR}/Semi.Avalonia.Demo.Desktop"
|
||
cp publish/Info-macOS.plist "${APP_DIR}/Contents/Info.plist"
|
||
codesign --force --deep --sign - "${APP_DIR}"
|
||
mkdir -p dmg_stage
|
||
ditto "${APP_DIR}" "dmg_stage/Semi.Avalonia.Demo.app"
|
||
brew install create-dmg
|
||
rm -f Semi.Avalonia.Demo.Desktop.osx-x64.dmg
|
||
create-dmg \
|
||
--volname "Semi Avalonia Demo" \
|
||
--window-pos 200 120 \
|
||
--window-size 640 400 \
|
||
--icon-size 100 \
|
||
--icon "Semi.Avalonia.Demo.app" 175 185 \
|
||
--hide-extension "Semi.Avalonia.Demo.app" \
|
||
--app-drop-link 455 185 \
|
||
--skip-jenkins \
|
||
"Semi.Avalonia.Demo.Desktop.osx-x64.dmg" \
|
||
"dmg_stage"
|
||
|
||
- name: Upload a Build Artifact
|
||
uses: actions/upload-artifact@v4.6.2
|
||
with:
|
||
name: Semi.Avalonia.Demo.Desktop.osx-x64
|
||
path: |
|
||
publish
|
||
!publish/*.pdb
|
||
|
||
- name: Upload macOS DMG (Intel)
|
||
uses: actions/upload-artifact@v4.6.2
|
||
with:
|
||
name: Semi.Avalonia.Demo.Desktop.osx-x64.dmg
|
||
path: Semi.Avalonia.Demo.Desktop.osx-x64.dmg
|
||
|
||
osx-arm64-aot:
|
||
if: ${{inputs.osx-arm64-aot}}
|
||
runs-on: macos-latest
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v5
|
||
|
||
- name: Setup dotnet
|
||
uses: actions/setup-dotnet@v5
|
||
with:
|
||
dotnet-version: ${{ env.DOTNET_SDK_VERSION_NET8 }}
|
||
|
||
- name: Enable Native AOT in .csproj
|
||
run: sed -i '' 's#<!--<PublishAot>true</PublishAot>-->#<PublishAot>true</PublishAot>#' demo/Semi.Avalonia.Demo.Desktop/Semi.Avalonia.Demo.Desktop.csproj
|
||
- name: Publish osx-arm64 AOT
|
||
run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r osx-arm64 -c Release -o publish
|
||
- name: Upload a Build Artifact
|
||
uses: actions/upload-artifact@v4.6.2
|
||
with:
|
||
name: Semi.Avalonia.Demo.Desktop.osx-arm64.NativeAOT
|
||
path: |
|
||
publish
|
||
!publish/*.pdb
|
||
|
||
osx-x64-aot:
|
||
if: ${{inputs.osx-x64-aot}}
|
||
runs-on: macos-latest
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v5
|
||
|
||
- name: Setup dotnet
|
||
uses: actions/setup-dotnet@v5
|
||
with:
|
||
dotnet-version: ${{ env.DOTNET_SDK_VERSION_NET8 }}
|
||
|
||
- name: Enable Native AOT in .csproj
|
||
run: sed -i '' 's#<!--<PublishAot>true</PublishAot>-->#<PublishAot>true</PublishAot>#' demo/Semi.Avalonia.Demo.Desktop/Semi.Avalonia.Demo.Desktop.csproj
|
||
- name: Publish osx-x64 AOT
|
||
run: dotnet publish demo/Semi.Avalonia.Demo.Desktop -r osx-x64 -c Release -o publish
|
||
- name: Upload a Build Artifact
|
||
uses: actions/upload-artifact@v4.6.2
|
||
with:
|
||
name: Semi.Avalonia.Demo.Desktop.osx-x64.NativeAOT
|
||
path: |
|
||
publish
|
||
!publish/*.pdb
|
||
|
||
android-arm64:
|
||
if: ${{inputs.android-arm64 }}
|
||
runs-on: windows-latest
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v5
|
||
- name: Setup dotnet
|
||
uses: actions/setup-dotnet@v5
|
||
with:
|
||
dotnet-version: ${{ env.DOTNET_SDK_VERSION_NET10 }}
|
||
- name: Install Android workload
|
||
run: dotnet workload install android
|
||
- name: Restore Dependencies
|
||
run: dotnet restore demo/Semi.Avalonia.Demo.Android
|
||
- name: Publish Android
|
||
run: dotnet publish demo/Semi.Avalonia.Demo.Android -c Release -f net10.0-android --no-restore -o publish /p:RuntimeIdentifier=android-arm64
|
||
- name: Upload a Build Artifact
|
||
uses: actions/upload-artifact@v4.6.2
|
||
with:
|
||
name: android-arm64
|
||
path: publish/*Signed.apk
|