From fc990505e3cbe2cf1ceb0ae6f389e6fc36b1cd2a Mon Sep 17 00:00:00 2001 From: Gaoyang Date: Fri, 24 Jul 2026 10:50:44 +0800 Subject: [PATCH] refactor: split CI into build/release jobs and clarify artifact naming Move tag-only publish/zip/release steps into a separate release job gated by a single job-level if, removing the repeated startsWith(github.ref, 'refs/tags/v') condition on every step. Rename release zips so both share the "portable" prefix and are distinguished only by runtime dependency (runtime-required vs standalone), avoiding the implication that only one build is portable. --- .github/workflows/ci.yml | 29 ++++++++++++++++++++--------- CLAUDE.md | 9 +++++++-- README.md | 12 ++++++------ 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b02b9cb..b50e4b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,8 +11,6 @@ permissions: jobs: build: runs-on: windows-latest - permissions: - contents: write steps: - uses: actions/checkout@v4 @@ -27,36 +25,49 @@ jobs: - name: Build run: dotnet build -c Release + release: + needs: build + if: startsWith(github.ref, 'refs/tags/v') + runs-on: windows-latest + permissions: + contents: write + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # MinVer needs full history for version calculation + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '10.0.x' + - name: Publish - if: startsWith(github.ref, 'refs/tags/v') run: dotnet publish src/PayBeat.App/PayBeat.App.csproj -c Release -r win-x64 --no-self-contained -o publish/ - name: Publish (self-contained) - if: startsWith(github.ref, 'refs/tags/v') run: dotnet publish src/PayBeat.App/PayBeat.App.csproj -c Release -r win-x64 --self-contained -o publish-selfcontained/ - name: Zip artifact - if: startsWith(github.ref, 'refs/tags/v') shell: pwsh run: | $version = "${{ github.ref_name }}" - $zipName = "PayBeat-$version-portable-win-x64.zip" + $zipName = "PayBeat-$version-portable-runtime-required-win-x64.zip" Compress-Archive -Path "publish/*" -DestinationPath $zipName echo "ZIP_NAME=$zipName" >> $env:GITHUB_ENV - name: Zip artifact (self-contained) - if: startsWith(github.ref, 'refs/tags/v') shell: pwsh run: | $version = "${{ github.ref_name }}" - $zipNameSelfContained = "PayBeat-$version-selfcontained-win-x64.zip" + $zipNameSelfContained = "PayBeat-$version-portable-standalone-win-x64.zip" Compress-Archive -Path "publish-selfcontained/*" -DestinationPath $zipNameSelfContained echo "ZIP_NAME_SELFCONTAINED=$zipNameSelfContained" >> $env:GITHUB_ENV - name: Create GitHub Release - if: startsWith(github.ref, 'refs/tags/v') uses: softprops/action-gh-release@v2 with: + name: PayBeat ${{ github.ref_name }} files: | ${{ env.ZIP_NAME }} ${{ env.ZIP_NAME_SELFCONTAINED }} diff --git a/CLAUDE.md b/CLAUDE.md index f527dda..0195c37 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -16,10 +16,15 @@ dotnet build # Run dotnet run --project src/PayBeat.App/PayBeat.App.csproj -# Publish +# Publish (portable, requires .NET 10 Desktop Runtime on target machine) dotnet publish src/PayBeat.App/PayBeat.App.csproj -c Release + +# Publish (self-contained, no runtime prerequisite) +dotnet publish src/PayBeat.App/PayBeat.App.csproj -c Release -r win-x64 --self-contained ``` +Output goes to `artifacts/bin/PayBeat.App/release/`. + ## Architecture WPF floating widget app (.NET 10, MVVM). Shows real-time earnings as a borderless, always-on-top window, plus a system tray icon for display-mode switching, Settings/About, and Exit. @@ -69,7 +74,7 @@ Artifacts output to `artifacts/bin///` (SDK artifacts layou ## CI / Release -`.github/workflows/ci.yml` builds on every push (Windows runner, .NET 10). On a `v*` tag push, it additionally publishes a self-contained-false `win-x64` build, zips it, and creates a GitHub Release via `softprops/action-gh-release`. Versioning is derived from git tags via MinVer (e.g. `v1.2.0`); locally, ensure the tag is reachable from HEAD for a meaningful version. +`.github/workflows/ci.yml` has two jobs (Windows runner, .NET 10). `build` runs on every push and just compiles. `release` runs `needs: build` with a job-level `if: startsWith(github.ref, 'refs/tags/v')` — only on a `v*` tag push does it publish both a portable (`--no-self-contained`) and a self-contained `win-x64` build, zip each (`PayBeat--portable-runtime-required-win-x64.zip`, `PayBeat--portable-standalone-win-x64.zip`), and create a GitHub Release via `softprops/action-gh-release`. Versioning is derived from git tags via MinVer (e.g. `v1.2.0`); locally, ensure the tag is reachable from HEAD for a meaningful version. User settings are persisted to `%APPDATA%\PayBeat\settings.json`. diff --git a/README.md b/README.md index 9aa931e..f999f42 100644 --- a/README.md +++ b/README.md @@ -43,8 +43,8 @@ PayBeat is a borderless, always-on-top Windows widget that shows your real-time Grab the latest release from the [Releases page](https://github.com/coldhighsun/PayBeat/releases/latest). Two `win-x64` packages are published per version: -- `PayBeat--portable-win-x64.zip` — smaller, requires the .NET 10 Desktop Runtime -- `PayBeat--selfcontained-win-x64.zip` — larger, runs standalone with no prerequisites +- `PayBeat--portable-runtime-required-win-x64.zip` — smaller, requires the .NET 10 Desktop Runtime +- `PayBeat--portable-standalone-win-x64.zip` — larger, runs standalone with no prerequisites ## Build @@ -62,7 +62,7 @@ dotnet publish src/PayBeat.App/PayBeat.App.csproj -c Release dotnet publish src/PayBeat.App/PayBeat.App.csproj -c Release -r win-x64 --self-contained ``` -Output goes to `artifacts/bin/PayBeat.App/release/`. CI tags produce both a `PayBeat--portable-win-x64.zip` and a `PayBeat--selfcontained-win-x64.zip` release artifact. +Output goes to `artifacts/bin/PayBeat.App/release/`. CI tags produce both a `PayBeat--portable-runtime-required-win-x64.zip` and a `PayBeat--portable-standalone-win-x64.zip` release artifact. ## Usage @@ -132,8 +132,8 @@ PayBeat 是一款 Windows 桌面悬浮组件,以秒为单位实时显示当天 前往 [Releases 页面](https://github.com/coldhighsun/PayBeat/releases/latest) 下载最新版本。每个版本会发布两个 `win-x64` 压缩包: -- `PayBeat--portable-win-x64.zip` — 体积较小,需预装 .NET 10 Desktop Runtime -- `PayBeat--selfcontained-win-x64.zip` — 体积较大,内置运行时,无需任何前置依赖 +- `PayBeat--portable-runtime-required-win-x64.zip` — 体积较小,需预装 .NET 10 Desktop Runtime +- `PayBeat--portable-standalone-win-x64.zip` — 体积较大,内置运行时,无需任何前置依赖 ## 构建 @@ -151,7 +151,7 @@ dotnet publish src/PayBeat.App/PayBeat.App.csproj -c Release dotnet publish src/PayBeat.App/PayBeat.App.csproj -c Release -r win-x64 --self-contained ``` -产物输出至 `artifacts/bin/PayBeat.App/release/`。CI 打标签时会同时生成 `PayBeat--portable-win-x64.zip` 和 `PayBeat--selfcontained-win-x64.zip` 两个发布包。 +产物输出至 `artifacts/bin/PayBeat.App/release/`。CI 打标签时会同时生成 `PayBeat--portable-runtime-required-win-x64.zip` 和 `PayBeat--portable-standalone-win-x64.zip` 两个发布包。 ## 使用