From 3d22c04a0431fecd9a3a0ba55df7c6c63c85b6f8 Mon Sep 17 00:00:00 2001 From: lincube Date: Wed, 4 Mar 2026 03:41:59 +0800 Subject: [PATCH] 0.2.8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 天气组件、倒计时组件微调。引入浏览器组件。 --- .github/README.md | 178 ++++ .github/workflows/build.yml | 100 ++- .github/workflows/code-quality.yml | 53 +- .github/workflows/issue-management.yml | 36 +- .github/workflows/release.yml | 299 +++---- LanMontainDesktop/App.axaml | 5 + LanMontainDesktop/App.axaml.cs | 4 +- .../ComponentSystem/BuiltInComponentIds.cs | 1 + .../ComponentSystem/ComponentRegistry.cs | 10 + LanMontainDesktop/LanMontainDesktop.csproj | 2 + LanMontainDesktop/Localization/en-US.json | 1 + LanMontainDesktop/Localization/zh-CN.json | 1 + .../Models/StudyAnalyticsModels.cs | 138 ++++ LanMontainDesktop/Program.cs | 4 +- .../Services/IStudyAnalyticsService.cs | 48 ++ .../Services/StudyAnalyticsInternals.cs | 492 +++++++++++ .../Services/StudyAnalyticsService.cs | 493 +++++++++++ .../Views/Components/BrowserWidget.axaml | 73 ++ .../Views/Components/BrowserWidget.axaml.cs | 291 +++++++ .../DesktopComponentRuntimeRegistry.cs | 5 + .../Components/ExtendedWeatherWidget.axaml | 34 +- .../Components/ExtendedWeatherWidget.axaml.cs | 24 +- .../Components/HolidayCalendarWidget.axaml | 124 +-- .../Components/HolidayCalendarWidget.axaml.cs | 217 ++++- .../Components/IDesktopComponentWidget.cs | 5 + .../Views/Components/WeatherWidget.axaml.cs | 70 +- .../Views/MainWindow.ComponentSystem.cs | 44 + .../Views/MainWindow.DesktopPaging.cs | 2 + .../Views/MainWindow.Settings.cs | 2 + noise.md | 771 ++++++++++++++++++ scripts/build.sh | 307 +++---- 31 files changed, 3258 insertions(+), 576 deletions(-) create mode 100644 .github/README.md create mode 100644 LanMontainDesktop/Models/StudyAnalyticsModels.cs create mode 100644 LanMontainDesktop/Services/IStudyAnalyticsService.cs create mode 100644 LanMontainDesktop/Services/StudyAnalyticsInternals.cs create mode 100644 LanMontainDesktop/Services/StudyAnalyticsService.cs create mode 100644 LanMontainDesktop/Views/Components/BrowserWidget.axaml create mode 100644 LanMontainDesktop/Views/Components/BrowserWidget.axaml.cs create mode 100644 noise.md diff --git a/.github/README.md b/.github/README.md new file mode 100644 index 0000000..f229fdf --- /dev/null +++ b/.github/README.md @@ -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) +**状态:** ✅ 生产可用 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 697ffdf..574c587 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 4ef433b..0b20c63 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -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 diff --git a/.github/workflows/issue-management.yml b/.github/workflows/issue-management.yml index 2d2e9ca..776a6ed 100644 --- a/.github/workflows/issue-management.yml +++ b/.github/workflows/issue-management.yml @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4790b40..237c01a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 '()[^<]*()', "`$1$version`$2" | Set-Content LanMontainDesktop/LanMontainDesktop.csproj - (Get-Content LanMontainDesktop.RecommendationBackend/LanMontainDesktop.RecommendationBackend.csproj) -replace '()[^<]*()', "`$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>/${{ needs.prepare.outputs.version }}<\/Version>/g' LanMontainDesktop/LanMontainDesktop.csproj - sed -i 's/[^<]*<\/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>/${{ needs.prepare.outputs.version }}<\/Version>/g' LanMontainDesktop/LanMontainDesktop.csproj - sed -i '' 's/[^<]*<\/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 }} diff --git a/LanMontainDesktop/App.axaml b/LanMontainDesktop/App.axaml index 4bfdaa9..aacd6e5 100644 --- a/LanMontainDesktop/App.axaml +++ b/LanMontainDesktop/App.axaml @@ -28,6 +28,11 @@ + + +