mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-20 23:54:26 +08:00
0.2.8
天气组件、倒计时组件微调。引入浏览器组件。
This commit is contained in:
178
.github/README.md
vendored
Normal file
178
.github/README.md
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
# LanMontainDesktop GitHub Actions CI/CD
|
||||
|
||||
参考 ClassIsland 项目最佳实践,为 LanMontainDesktop 配置的 GitHub Actions 工作流。
|
||||
|
||||
## 📋 工作流说明
|
||||
|
||||
### 1. Build (`build.yml`)
|
||||
**何时运行:** 每次 push、PR、手动触发
|
||||
|
||||
**功能:**
|
||||
- Windows: Release + Debug 配置
|
||||
- Linux: Release 配置
|
||||
- macOS: Release 配置
|
||||
- 上传编译输出 artifacts
|
||||
|
||||
**运行时间:** ~5-10 分钟
|
||||
|
||||
### 2. Quality Check (`code-quality.yml`)
|
||||
**何时运行:** PR 或 push
|
||||
|
||||
**功能:**
|
||||
- 编译检查
|
||||
- 代码格式检查 (`dotnet format`)
|
||||
|
||||
**运行时间:** ~3-5 分钟
|
||||
|
||||
### 3. Release (`release.yml`)
|
||||
**何时运行:** Push 标签 (`v*`) 或手动触发
|
||||
|
||||
**功能:**
|
||||
- 并行构建所有平台 (Windows x64/x86, Linux x64, macOS x64/arm64)
|
||||
- 自动创建 GitHub Release
|
||||
- 上传所有平台的可执行包
|
||||
|
||||
**运行时间:** ~20-30 分钟
|
||||
|
||||
**触发方式:**
|
||||
|
||||
```bash
|
||||
# 推送标签 - 自动触发
|
||||
git tag v1.0.0
|
||||
git push origin v1.0.0
|
||||
|
||||
# 或手动触发
|
||||
# GitHub Actions > Release > Run workflow
|
||||
# 输入: tag (例如 v1.0.0)
|
||||
```
|
||||
|
||||
### 4. Issue Management (`issue-management.yml`)
|
||||
**何时运行:** 每天 1:30 AM UTC
|
||||
|
||||
**功能:**
|
||||
- 标记 30 天无活动的 Issue
|
||||
- 关闭 7 天无活动的 stale Issue
|
||||
- 对 PR 同样处理
|
||||
|
||||
---
|
||||
|
||||
## 🚀 快速开始
|
||||
|
||||
### 创建版本发布
|
||||
|
||||
```bash
|
||||
# 1. 提交最后的更改
|
||||
git add .
|
||||
git commit -m "Release v1.0.0"
|
||||
|
||||
# 2. 创建标签
|
||||
git tag v1.0.0 -m "Release version 1.0.0"
|
||||
|
||||
# 3. 推送
|
||||
git push origin main
|
||||
git push origin v1.0.0
|
||||
|
||||
# 4. 等待... (GitHub Actions 自动构建)
|
||||
# 约 20-30 分钟后,Release 将自动创建
|
||||
```
|
||||
|
||||
### 查看工作流状态
|
||||
|
||||
访问: **GitHub 项目 > Actions 标签**
|
||||
|
||||
---
|
||||
|
||||
## 📁 支持的平台与格式
|
||||
|
||||
| 平台 | 架构 | 输出格式 |
|
||||
|------|------|---------|
|
||||
| Windows | x64, x86 | `.zip` |
|
||||
| Linux | x64 | `.tar.gz` |
|
||||
| macOS | x64, arm64 | `.tar.gz` |
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ 本地构建参考
|
||||
|
||||
### Windows
|
||||
|
||||
```bash
|
||||
# 使用现有脚本
|
||||
.\LanMontainDesktop\scripts\package.ps1 -RuntimeIdentifier win-x64
|
||||
|
||||
# 或用 dotnet 直接构建
|
||||
dotnet build -c Release
|
||||
dotnet publish LanMontainDesktop/LanMontainDesktop.csproj `
|
||||
-c Release -r win-x64 -o ./publish/win-x64 `
|
||||
--self-contained -p:PublishSingleFile=true
|
||||
```
|
||||
|
||||
### Linux / macOS
|
||||
|
||||
```bash
|
||||
# 使用 build 脚本
|
||||
chmod +x scripts/build.sh
|
||||
./scripts/build.sh publish --config Release --rid linux-x64
|
||||
./scripts/build.sh publish --config Release --rid osx-x64
|
||||
./scripts/build.sh publish --config Release --rid osx-arm64
|
||||
|
||||
# 或用 dotnet 直接构建
|
||||
dotnet build -c Release
|
||||
dotnet publish LanMontainDesktop/LanMontainDesktop.csproj \
|
||||
-c Release -r linux-x64 -o ./publish/linux-x64 \
|
||||
--self-contained -p:PublishSingleFile=true
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📊 Actions 使用统计
|
||||
|
||||
**免费额度:** 2000 runner-hours/月 (对大多数项目用不完)
|
||||
|
||||
**预计使用:**
|
||||
- Build job: ~3-5 分钟 × 3 平台
|
||||
- Code quality: ~3-5 分钟
|
||||
- Release: ~25-30 分钟 × 1/周
|
||||
|
||||
**月总计:** ~30-50 分钟 × 20+ 次 = ~600-1000 分钟 (远低于免费额度)
|
||||
|
||||
---
|
||||
|
||||
## 🐛 常见问题
|
||||
|
||||
### Release 工作流不运行?
|
||||
|
||||
检查:
|
||||
1. 标签格式是否为 `v*` (例如:`v1.0.0`)
|
||||
2. `.csproj` 文件是否有效
|
||||
3. GitHub Actions 是否已启用
|
||||
|
||||
### 特定平台构建失败?
|
||||
|
||||
查看 Actions 日志:
|
||||
1. **Windows**: 检查 libvlc 依赖
|
||||
2. **Linux**: 检查系统库依赖
|
||||
3. **macOS**: 检查 Xcode 工具链
|
||||
|
||||
### 如何跳过某个工作流?
|
||||
|
||||
在 commit 消息中添加:
|
||||
```
|
||||
[skip ci] # 跳过所有工作流
|
||||
[skip build] # 跳过构建
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔗 参考
|
||||
|
||||
- [ClassIsland CI/CD](https://github.com/ClassIsland/ClassIsland/.github/workflows/)
|
||||
- [GitHub Actions 文档](https://docs.github.com/actions)
|
||||
- [.NET 发布指南](https://learn.microsoft.com/dotnet/core/tools/dotnet-publish)
|
||||
- [Avalonia 部署](https://docs.avaloniaui.net/docs/deployment)
|
||||
|
||||
---
|
||||
|
||||
**更新:** 2026-03-04
|
||||
**版本:** 2.0 (参考 ClassIsland)
|
||||
**状态:** ✅ 生产可用
|
||||
100
.github/workflows/build.yml
vendored
100
.github/workflows/build.yml
vendored
@@ -1,25 +1,25 @@
|
||||
name: Build & Test
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, master, dev, develop ]
|
||||
pull_request:
|
||||
branches: [ main, master, dev, develop ]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
DOTNET_VERSION: '10.0.x'
|
||||
Solution_Name: LanMontainDesktop.sln
|
||||
|
||||
jobs:
|
||||
build:
|
||||
build-windows:
|
||||
runs-on: windows-latest
|
||||
name: Build_Windows_${{ matrix.configuration }}
|
||||
strategy:
|
||||
matrix:
|
||||
configuration: [ Debug, Release ]
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
@@ -30,27 +30,87 @@ jobs:
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
|
||||
- name: Restore dependencies
|
||||
- name: Restore
|
||||
run: dotnet restore
|
||||
|
||||
- name: Build LanMontainDesktop
|
||||
run: dotnet build LanMontainDesktop/LanMontainDesktop.csproj -c ${{ matrix.configuration }} --no-restore
|
||||
- name: Build
|
||||
run: dotnet build --no-restore -c ${{ matrix.configuration }} -v minimal
|
||||
|
||||
- name: Build RecommendationBackend
|
||||
run: dotnet build LanMontainDesktop.RecommendationBackend/LanMontainDesktop.RecommendationBackend.csproj -c ${{ matrix.configuration }} --no-restore
|
||||
|
||||
- name: Test LanMontainDesktop
|
||||
run: dotnet test LanMontainDesktop/LanMontainDesktop.csproj -c ${{ matrix.configuration }} --no-build --verbosity normal --logger "trx;LogFileName=test-results.trx" || true
|
||||
|
||||
- name: Test RecommendationBackend
|
||||
run: dotnet test LanMontainDesktop.RecommendationBackend/LanMontainDesktop.RecommendationBackend.csproj -c ${{ matrix.configuration }} --no-build --verbosity normal --logger "trx;LogFileName=test-results.trx" || true
|
||||
|
||||
- name: Upload build artifacts
|
||||
if: always()
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-output-${{ matrix.configuration }}
|
||||
name: build-windows-${{ matrix.configuration }}
|
||||
path: |
|
||||
LanMontainDesktop/bin/${{ matrix.configuration }}/
|
||||
LanMontainDesktop.RecommendationBackend/bin/${{ matrix.configuration }}/
|
||||
retention-days: 7
|
||||
|
||||
build-linux:
|
||||
runs-on: ubuntu-latest
|
||||
name: Build_Linux
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
libfontconfig1 libfreetype6 \
|
||||
libx11-6 libxrandr2 libxinerama1 \
|
||||
libxi6 libxcursor1 libxext6
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
|
||||
- name: Restore
|
||||
run: dotnet restore
|
||||
|
||||
- name: Build
|
||||
run: dotnet build --no-restore -c Release -v minimal
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-linux
|
||||
path: |
|
||||
LanMontainDesktop/bin/Release/
|
||||
LanMontainDesktop.RecommendationBackend/bin/Release/
|
||||
retention-days: 7
|
||||
|
||||
build-macos:
|
||||
runs-on: macos-latest
|
||||
name: Build_macOS
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
|
||||
- name: Restore
|
||||
run: dotnet restore
|
||||
|
||||
- name: Build
|
||||
run: dotnet build --no-restore -c Release -v minimal
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-macos
|
||||
path: |
|
||||
LanMontainDesktop/bin/Release/
|
||||
LanMontainDesktop.RecommendationBackend/bin/Release/
|
||||
retention-days: 7
|
||||
|
||||
53
.github/workflows/code-quality.yml
vendored
53
.github/workflows/code-quality.yml
vendored
@@ -1,17 +1,16 @@
|
||||
name: Code Quality
|
||||
name: Quality Check
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
branches: [ main, master, dev, develop ]
|
||||
push:
|
||||
branches: [ main, master, dev, develop ]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
DOTNET_VERSION: '10.0.x'
|
||||
|
||||
jobs:
|
||||
code-analysis:
|
||||
analyze:
|
||||
runs-on: windows-latest
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -19,7 +18,7 @@ jobs:
|
||||
checks: write
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
@@ -31,44 +30,12 @@ jobs:
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
|
||||
- name: Restore dependencies
|
||||
- name: Restore
|
||||
run: dotnet restore
|
||||
|
||||
- name: Build projects
|
||||
run: |
|
||||
dotnet build LanMontainDesktop/LanMontainDesktop.csproj
|
||||
dotnet build LanMontainDesktop.RecommendationBackend/LanMontainDesktop.RecommendationBackend.csproj
|
||||
- name: Build
|
||||
run: dotnet build -c Release --no-restore -v minimal
|
||||
|
||||
# 可以添加Qodana检查(如果配置了token)
|
||||
# - name: Run Qodana Analysis
|
||||
# uses: JetBrains/qodana-action@v2025.1
|
||||
# with:
|
||||
# pr-mode: true
|
||||
# env:
|
||||
# QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
|
||||
# QODANA_ENDPOINT: 'https://qodana.cloud'
|
||||
|
||||
dotnet-format:
|
||||
runs-on: windows-latest
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
|
||||
- name: Check code formatting
|
||||
run: |
|
||||
dotnet format --verify-no-changes --verbosity diagnostic || (
|
||||
echo "::warning::Code formatting issues detected. Please run 'dotnet format' locally."
|
||||
exit 0
|
||||
)
|
||||
- name: Check formatting
|
||||
run: dotnet format --verify-no-changes --verbosity diagnostic || true
|
||||
continue-on-error: true
|
||||
|
||||
36
.github/workflows/issue-management.yml
vendored
36
.github/workflows/issue-management.yml
vendored
@@ -1,13 +1,12 @@
|
||||
name: Issue Management
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
# Every day at 1:30 AM UTC
|
||||
- cron: "30 1 * * *"
|
||||
- cron: "30 1 * * *" # Daily at 1:30 AM UTC
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
close-stale-issues:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
@@ -18,20 +17,17 @@ jobs:
|
||||
uses: actions/stale@v9
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
any-of-labels: 'need-more-info,waiting-for-response'
|
||||
days-before-issue-stale: 14
|
||||
days-before-issue-stale: 30
|
||||
days-before-issue-close: 7
|
||||
days-before-pr-stale: 21
|
||||
days-before-pr-close: 14
|
||||
stale-issue-label: 'stale'
|
||||
stale-pr-label: 'stale'
|
||||
stale-issue-message: |
|
||||
This issue has been inactive for 14 days.
|
||||
It will be closed in 7 days if there's no activity.
|
||||
Please comment to keep it open.
|
||||
stale-pr-message: |
|
||||
This PR has been inactive for 21 days.
|
||||
It will be closed in 14 days if there's no activity.
|
||||
Please comment or update the PR to keep it open.
|
||||
close-issue-message: 'Closed due to inactivity. Feel free to reopen if needed.'
|
||||
close-pr-message: 'Closed due to inactivity. Feel free to reopen if needed.'
|
||||
days-before-pr-stale: 30
|
||||
days-before-pr-close: 7
|
||||
stale-issue-label: stale
|
||||
stale-pr-label: stale
|
||||
close-issue-label: closed
|
||||
close-pr-label: closed
|
||||
stale-issue-message: This issue is stale and will be closed in 7 days
|
||||
stale-pr-message: This PR is stale and will be closed in 7 days
|
||||
close-issue-message: Closed as stale
|
||||
close-pr-message: Closed as stale
|
||||
exempt-issue-labels: pinned,security
|
||||
exempt-pr-labels: pinned,security
|
||||
|
||||
299
.github/workflows/release.yml
vendored
299
.github/workflows/release.yml
vendored
@@ -1,138 +1,98 @@
|
||||
name: Release & Publish (Multi-Platform)
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
- 'release-*'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Release version (e.g., 1.0.0)'
|
||||
tag:
|
||||
description: 'Release tag'
|
||||
required: true
|
||||
type: string
|
||||
is_prerelease:
|
||||
description: 'Mark as pre-release'
|
||||
description: 'Pre-release'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
build_windows:
|
||||
description: 'Build Windows (x64/x86)'
|
||||
required: false
|
||||
type: boolean
|
||||
default: true
|
||||
build_linux:
|
||||
description: 'Build Linux (x64)'
|
||||
required: false
|
||||
type: boolean
|
||||
default: true
|
||||
build_macos:
|
||||
description: 'Build macOS (x64/arm64)'
|
||||
required: false
|
||||
type: boolean
|
||||
default: true
|
||||
|
||||
env:
|
||||
DOTNET_VERSION: '10.0.x'
|
||||
Solution_Name: LanMontainDesktop.sln
|
||||
|
||||
jobs:
|
||||
prepare:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
version: ${{ steps.version.outputs.version }}
|
||||
is_prerelease: ${{ steps.version.outputs.is_prerelease }}
|
||||
build_windows: ${{ steps.versions.outputs.build_windows }}
|
||||
build_linux: ${{ steps.versions.outputs.build_linux }}
|
||||
build_macos: ${{ steps.versions.outputs.build_macos }}
|
||||
tag: ${{ steps.version.outputs.tag }}
|
||||
|
||||
steps:
|
||||
- name: Get version from tag or input
|
||||
- name: Get release info
|
||||
id: version
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "push" ]]; then
|
||||
VERSION=${GITHUB_REF#refs/tags/}
|
||||
TAG=${GITHUB_REF#refs/tags/}
|
||||
else
|
||||
VERSION=${{ github.event.inputs.version }}
|
||||
TAG=${{ github.event.inputs.tag }}
|
||||
fi
|
||||
VERSION=${VERSION#v}
|
||||
IS_PRERELEASE=${{ github.event.inputs.is_prerelease }}
|
||||
VERSION=${TAG#v}
|
||||
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
||||
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||
echo "is_prerelease=${IS_PRERELEASE}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Determine build targets
|
||||
id: versions
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "push" ]]; then
|
||||
echo "build_windows=true" >> $GITHUB_OUTPUT
|
||||
echo "build_linux=true" >> $GITHUB_OUTPUT
|
||||
echo "build_macos=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "build_windows=${{ github.event.inputs.build_windows }}" >> $GITHUB_OUTPUT
|
||||
echo "build_linux=${{ github.event.inputs.build_linux }}" >> $GITHUB_OUTPUT
|
||||
echo "build_macos=${{ github.event.inputs.build_macos }}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
build-windows:
|
||||
if: needs.prepare.outputs.build_windows == 'true'
|
||||
needs: prepare
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [ x64, x86 ]
|
||||
include:
|
||||
- arch: x64
|
||||
rid: win-x64
|
||||
- arch: x86
|
||||
rid: win-x86
|
||||
|
||||
name: Build Windows (${{ matrix.arch }})
|
||||
arch: [x64, x86]
|
||||
name: Build_Windows_${{ matrix.arch }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref }}
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
|
||||
- name: Update version in csproj
|
||||
run: |
|
||||
$version = "${{ needs.prepare.outputs.version }}"
|
||||
(Get-Content LanMontainDesktop/LanMontainDesktop.csproj) -replace '(<Version>)[^<]*(</Version>)', "`$1$version`$2" | Set-Content LanMontainDesktop/LanMontainDesktop.csproj
|
||||
(Get-Content LanMontainDesktop.RecommendationBackend/LanMontainDesktop.RecommendationBackend.csproj) -replace '(<Version>)[^<]*(</Version>)', "`$1$version`$2" | Set-Content LanMontainDesktop.RecommendationBackend/LanMontainDesktop.RecommendationBackend.csproj
|
||||
shell: pwsh
|
||||
|
||||
- name: Restore dependencies
|
||||
- name: Restore
|
||||
run: dotnet restore
|
||||
|
||||
- name: Publish LanMontainDesktop
|
||||
- name: Build
|
||||
run: dotnet build -c Release --no-restore -v minimal
|
||||
|
||||
- name: Publish
|
||||
run: |
|
||||
dotnet publish LanMontainDesktop/LanMontainDesktop.csproj `
|
||||
-c Release `
|
||||
-o ./publish/${{ matrix.rid }} `
|
||||
-r ${{ matrix.rid }} `
|
||||
-o ./publish/windows-${{ matrix.arch }} `
|
||||
--self-contained `
|
||||
-r win-${{ matrix.arch }} `
|
||||
-p:PublishSingleFile=true `
|
||||
-p:PublishTrimmed=false `
|
||||
-p:IncludeNativeLibrariesForSelfExtract=true
|
||||
-p:DebugType=none
|
||||
shell: pwsh
|
||||
|
||||
- name: Create Windows package
|
||||
- name: Package
|
||||
run: |
|
||||
$packageDir = "LanMontainDesktop-${{ needs.prepare.outputs.version }}-${{ matrix.rid }}"
|
||||
New-Item -ItemType Directory -Path $packageDir -Force | Out-Null
|
||||
Copy-Item "./publish/${{ matrix.rid }}/*" -Destination $packageDir -Recurse -Force
|
||||
Compress-Archive -Path $packageDir -DestinationPath "$packageDir.zip" -Force
|
||||
Write-Host "✅ Package created: $packageDir.zip"
|
||||
$version = "${{ needs.prepare.outputs.version }}"
|
||||
$arch = "${{ matrix.arch }}"
|
||||
$source = "publish/windows-$arch"
|
||||
$package = "LanMontainDesktop-$version-win-$arch"
|
||||
|
||||
New-Item -ItemType Directory -Path "$package" -Force | Out-Null
|
||||
Copy-Item -Path "$source/*" -Destination "$package" -Recurse -Force
|
||||
Compress-Archive -Path "$package" -DestinationPath "$package.zip" -Force
|
||||
|
||||
Write-Host "Created: $package.zip"
|
||||
shell: pwsh
|
||||
|
||||
- name: Upload artifacts
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-windows-${{ matrix.arch }}
|
||||
@@ -140,209 +100,160 @@ jobs:
|
||||
retention-days: 30
|
||||
|
||||
build-linux:
|
||||
if: needs.prepare.outputs.build_linux == 'true'
|
||||
needs: prepare
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [ x64 ]
|
||||
include:
|
||||
- arch: x64
|
||||
rid: linux-x64
|
||||
|
||||
name: Build Linux (${{ matrix.arch }})
|
||||
name: Build_Linux
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
libfontconfig1 libfreetype6 \
|
||||
libx11-6 libxrandr2 libxinerama1 \
|
||||
libxi6 libxcursor1 libxext6 \
|
||||
libxrender1 libxkbcommon-x11-0
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
|
||||
- name: Install Linux dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
libfontconfig1 \
|
||||
libfreetype6 \
|
||||
libx11-6 \
|
||||
libxrandr2 \
|
||||
libxinerama1 \
|
||||
libxi6 \
|
||||
libxcursor1 \
|
||||
libxext6 \
|
||||
libxrender1 \
|
||||
libxkbcommon-x11-0
|
||||
|
||||
- name: Update version in csproj
|
||||
run: |
|
||||
sed -i 's/<Version>[^<]*<\/Version>/<Version>${{ needs.prepare.outputs.version }}<\/Version>/g' LanMontainDesktop/LanMontainDesktop.csproj
|
||||
sed -i 's/<Version>[^<]*<\/Version>/<Version>${{ needs.prepare.outputs.version }}<\/Version>/g' LanMontainDesktop.RecommendationBackend/LanMontainDesktop.RecommendationBackend.csproj
|
||||
|
||||
- name: Restore dependencies
|
||||
- name: Restore
|
||||
run: dotnet restore
|
||||
|
||||
- name: Publish LanMontainDesktop
|
||||
- name: Build
|
||||
run: dotnet build -c Release --no-restore -v minimal
|
||||
|
||||
- name: Publish
|
||||
run: |
|
||||
dotnet publish LanMontainDesktop/LanMontainDesktop.csproj \
|
||||
-c Release \
|
||||
-o ./publish/${{ matrix.rid }} \
|
||||
-r ${{ matrix.rid }} \
|
||||
-o ./publish/linux-x64 \
|
||||
--self-contained \
|
||||
-r linux-x64 \
|
||||
-p:PublishSingleFile=true \
|
||||
-p:PublishTrimmed=false
|
||||
-p:DebugType=none
|
||||
|
||||
- name: Create Linux packages
|
||||
- name: Package
|
||||
run: |
|
||||
PACKAGE_DIR="LanMontainDesktop-${{ needs.prepare.outputs.version }}-${{ matrix.rid }}"
|
||||
mkdir -p "$PACKAGE_DIR"
|
||||
cp -r "./publish/${{ matrix.rid }}"/* "$PACKAGE_DIR/"
|
||||
version="${{ needs.prepare.outputs.version }}"
|
||||
source="publish/linux-x64"
|
||||
package="LanMontainDesktop-$version-linux-x64"
|
||||
|
||||
# Create tar.gz
|
||||
tar -czf "$PACKAGE_DIR.tar.gz" "$PACKAGE_DIR"
|
||||
echo "✅ Created: $PACKAGE_DIR.tar.gz"
|
||||
mkdir -p "$package"
|
||||
cp -r "$source"/* "$package/"
|
||||
tar -czf "$package.tar.gz" "$package"
|
||||
|
||||
# Optional: Create AppImage (requires specific tools)
|
||||
# This is commented out as it requires additional dependencies
|
||||
# appimage-builder or similar tools would go here
|
||||
echo "Created: $package.tar.gz"
|
||||
|
||||
- name: Upload artifacts
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-linux-${{ matrix.arch }}
|
||||
name: release-linux
|
||||
path: LanMontainDesktop-*.tar.gz
|
||||
retention-days: 30
|
||||
|
||||
build-macos:
|
||||
if: needs.prepare.outputs.build_macos == 'true'
|
||||
needs: prepare
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [ x64, arm64 ]
|
||||
include:
|
||||
- arch: x64
|
||||
rid: osx-x64
|
||||
- arch: arm64
|
||||
rid: osx-arm64
|
||||
|
||||
name: Build macOS (${{ matrix.arch }})
|
||||
arch: [x64, arm64]
|
||||
name: Build_macOS_${{ matrix.arch }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref }}
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
|
||||
- name: Update version in csproj
|
||||
run: |
|
||||
sed -i '' 's/<Version>[^<]*<\/Version>/<Version>${{ needs.prepare.outputs.version }}<\/Version>/g' LanMontainDesktop/LanMontainDesktop.csproj
|
||||
sed -i '' 's/<Version>[^<]*<\/Version>/<Version>${{ needs.prepare.outputs.version }}<\/Version>/g' LanMontainDesktop.RecommendationBackend/LanMontainDesktop.RecommendationBackend.csproj
|
||||
|
||||
- name: Restore dependencies
|
||||
- name: Restore
|
||||
run: dotnet restore
|
||||
|
||||
- name: Publish LanMontainDesktop
|
||||
- name: Build
|
||||
run: dotnet build -c Release --no-restore -v minimal
|
||||
|
||||
- name: Publish
|
||||
run: |
|
||||
dotnet publish LanMontainDesktop/LanMontainDesktop.csproj \
|
||||
-c Release \
|
||||
-o ./publish/${{ matrix.rid }} \
|
||||
-r ${{ matrix.rid }} \
|
||||
-o ./publish/macos-${{ matrix.arch }} \
|
||||
--self-contained \
|
||||
-r osx-${{ matrix.arch }} \
|
||||
-p:PublishSingleFile=true \
|
||||
-p:PublishTrimmed=false
|
||||
-p:DebugType=none
|
||||
|
||||
- name: Create macOS packages
|
||||
- name: Package
|
||||
run: |
|
||||
PACKAGE_DIR="LanMontainDesktop-${{ needs.prepare.outputs.version }}-${{ matrix.rid }}"
|
||||
mkdir -p "$PACKAGE_DIR"
|
||||
cp -r "./publish/${{ matrix.rid }}"/* "$PACKAGE_DIR/"
|
||||
version="${{ needs.prepare.outputs.version }}"
|
||||
arch="${{ matrix.arch }}"
|
||||
source="publish/macos-$arch"
|
||||
package="LanMontainDesktop-$version-macos-$arch"
|
||||
|
||||
# Create tar.gz
|
||||
tar -czf "$PACKAGE_DIR.tar.gz" "$PACKAGE_DIR"
|
||||
echo "✅ Created: $PACKAGE_DIR.tar.gz"
|
||||
mkdir -p "$package"
|
||||
cp -r "$source"/* "$package/"
|
||||
tar -czf "$package.tar.gz" "$package"
|
||||
|
||||
# Optional: Create DMG (requires additional tools)
|
||||
# DMG creation would go here if needed
|
||||
echo "Created: $package.tar.gz"
|
||||
|
||||
- name: Upload artifacts
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-macos-${{ matrix.arch }}
|
||||
path: LanMontainDesktop-*.tar.gz
|
||||
retention-days: 30
|
||||
|
||||
create-release:
|
||||
needs: prepare
|
||||
if: always()
|
||||
github-release:
|
||||
needs: [ prepare, build-windows, build-linux, build-macos ]
|
||||
runs-on: ubuntu-latest
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Download all artifacts
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: ./release-artifacts
|
||||
path: artifacts
|
||||
pattern: release-*
|
||||
|
||||
- name: List downloaded artifacts
|
||||
run: |
|
||||
echo "📦 Downloaded artifacts:"
|
||||
find ./release-artifacts -type f -name "*.zip" -o -name "*.tar.gz" | sort
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
- name: Create Release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
files: |
|
||||
release-artifacts/**/*.zip
|
||||
release-artifacts/**/*.tar.gz
|
||||
tag: ${{ github.ref_name }}
|
||||
draft: false
|
||||
prerelease: ${{ needs.prepare.outputs.is_prerelease }}
|
||||
prerelease: ${{ github.event.inputs.is_prerelease == 'true' }}
|
||||
artifacts: artifacts/**/*
|
||||
body: |
|
||||
## Release ${{ needs.prepare.outputs.version }}
|
||||
|
||||
### 📥 Downloads
|
||||
### Downloads
|
||||
|
||||
**Windows:**
|
||||
- `LanMontainDesktop-${{ needs.prepare.outputs.version }}-win-x64.zip` - Windows 64-bit
|
||||
- `LanMontainDesktop-${{ needs.prepare.outputs.version }}-win-x86.zip` - Windows 32-bit
|
||||
- win-x64 (64-bit)
|
||||
- win-x86 (32-bit)
|
||||
|
||||
**Linux:**
|
||||
- `LanMontainDesktop-${{ needs.prepare.outputs.version }}-linux-x64.tar.gz` - Linux 64-bit
|
||||
- linux-x64
|
||||
|
||||
**macOS:**
|
||||
- `LanMontainDesktop-${{ needs.prepare.outputs.version }}-osx-x64.tar.gz` - macOS Intel
|
||||
- `LanMontainDesktop-${{ needs.prepare.outputs.version }}-osx-arm64.tar.gz` - macOS Apple Silicon
|
||||
- macos-x64 (Intel)
|
||||
- macos-arm64 (Apple Silicon)
|
||||
|
||||
### 📝 Changes
|
||||
See commits for detailed changes: ${{ github.event.compare || 'https://github.com/${{ github.repository }}/commits/${{ github.sha }}' }}
|
||||
|
||||
### 💾 Installation
|
||||
|
||||
**Windows:** Extract zip and run `LanMontainDesktop.exe`
|
||||
|
||||
**Linux:** Extract tar.gz and run `./LanMontainDesktop`
|
||||
|
||||
**macOS:** Extract tar.gz and run `./LanMontainDesktop`
|
||||
|
||||
### ℹ️ System Requirements
|
||||
- .NET Runtime 10.0+ (included in self-contained builds)
|
||||
- Windows 10+, macOS 10.15+, or modern Linux distribution
|
||||
|
||||
---
|
||||
*Built by ${{ github.event.actor }} on ${{ github.event.head_commit.timestamp }}*
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
See commits for changes.
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
Reference in New Issue
Block a user