This commit is contained in:
lincube
2026-03-05 13:02:15 +08:00
parent 469f7e1132
commit c720d16e81
5 changed files with 74 additions and 67 deletions

View File

@@ -36,26 +36,24 @@ QODANA_ENDPOINT=https://qodana.cloud
``` ```
### 3. Release & Publish (`release.yml`) ### 3. Release & Publish (`release.yml`)
**Trigger:** Push git tags (v1.0.0, release-1.0.0), or manual workflow dispatch **Trigger:** Push git tags (`v*`, e.g. `v1.0.0`), or manual workflow dispatch
**What it does:** **What it does:**
- Builds for **Windows** (x64, x86) - self-contained executables - Builds **Windows** installers (x64, x86) via Inno Setup
- Builds for **Linux** (x64) - tar.gz packages - Builds **Linux** packages (x64) as `.deb`
- Builds for **macOS** (x64, arm64) - universal support - Builds **macOS** packages (x64, arm64) as `.dmg`
- Publishes optimized release builds for all platforms - Publishes optimized release builds for all platforms
- Generates GitHub Release with all platform artifacts - Generates GitHub Release with installer/package assets
- Supports pre-release versions - Supports pre-release versions
**Supported Platforms:** **Supported Platforms:**
| Platform | Architectures | Output Format | Status | | Platform | Architectures | Output Format | Status |
|----------|---------------|---------------|--------| |----------|---------------|---------------|--------|
| Windows | x64, x86 | .zip | ✅ Full support | | Windows | x64, x86 | .exe (installer) | ✅ Full support |
| Linux | x64 | .tar.gz | ✅ Full support | | Linux | x64 | .deb | ✅ Full support |
| macOS | x64, arm64 (Apple Silicon) | .tar.gz | ✅ Full support | | macOS | x64, arm64 (Apple Silicon) | .dmg | ✅ Full support |
**Build Scripts:** > Note: GitHub Actions artifacts are downloaded as zip containers. The actual packaged files inside are `.exe`, `.deb`, and `.dmg`.
- Windows: Uses PowerShell (`LanMountainDesktop\scripts\package.ps1`)
- Linux/macOS: Uses Bash (`scripts/build.sh`)
**Usage:** **Usage:**
@@ -66,13 +64,9 @@ git push origin v1.0.0
# Automatically triggers Windows + Linux + macOS builds # Automatically triggers Windows + Linux + macOS builds
``` ```
*Manual trigger with selective platforms:* *Manual trigger:*
Go to GitHub > Actions > Release & Publish > Run workflow Go to GitHub > Actions > Release & Publish > Run workflow
- Specify version: `1.0.0` - Specify release tag: `v1.0.0` (or `1.0.0`, workflow will normalize to `v1.0.0`)
- Toggle build targets as needed:
- ✅ Build Windows (x64/x86)
- ✅ Build Linux (x64)
- ✅ Build macOS (x64/arm64)
- Check pre-release option if needed - Check pre-release option if needed
### 4. Issue Management (`issue-management.yml`) ### 4. Issue Management (`issue-management.yml`)

View File

@@ -2,6 +2,8 @@
on: on:
push: push:
tags-ignore:
- '*'
pull_request: pull_request:
workflow_dispatch: workflow_dispatch:

View File

@@ -26,19 +26,30 @@ jobs:
outputs: outputs:
version: ${{ steps.version.outputs.version }} version: ${{ steps.version.outputs.version }}
tag: ${{ steps.version.outputs.tag }} tag: ${{ steps.version.outputs.tag }}
checkout_ref: ${{ steps.version.outputs.checkout_ref }}
steps: steps:
- name: Get release info - name: Get release info
id: version id: version
run: | run: |
if [[ "${{ github.event_name }}" == "push" ]]; then if [[ "${{ github.event_name }}" == "push" ]]; then
TAG=${GITHUB_REF#refs/tags/} TAG="${GITHUB_REF#refs/tags/}"
CHECKOUT_REF="${GITHUB_REF}"
else else
TAG=${{ github.event.inputs.tag }} RAW_TAG="${{ github.event.inputs.tag }}"
if [[ "${RAW_TAG}" == refs/tags/* ]]; then
TAG="${RAW_TAG#refs/tags/}"
elif [[ "${RAW_TAG}" == v* ]]; then
TAG="${RAW_TAG}"
else
TAG="v${RAW_TAG}"
fi
CHECKOUT_REF="${GITHUB_SHA}"
fi fi
VERSION=${TAG#v} VERSION="${TAG#v}"
echo "tag=${TAG}" >> $GITHUB_OUTPUT echo "tag=${TAG}" >> $GITHUB_OUTPUT
echo "version=${VERSION}" >> $GITHUB_OUTPUT echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "checkout_ref=${CHECKOUT_REF}" >> $GITHUB_OUTPUT
build-windows: build-windows:
needs: prepare needs: prepare
@@ -54,7 +65,7 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
submodules: recursive submodules: recursive
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref }} ref: ${{ needs.prepare.outputs.checkout_ref }}
- name: Setup .NET - name: Setup .NET
uses: actions/setup-dotnet@v4 uses: actions/setup-dotnet@v4
@@ -141,20 +152,26 @@ jobs:
# Build installer with iscc.exe # Build installer with iscc.exe
Write-Host "Building installer for Windows $arch with version $version..." Write-Host "Building installer for Windows $arch with version $version..."
$compileCmd = @( $publishDir = (Resolve-Path $publishDir).Path
"`"$isccPath`"", $outputDir = (Resolve-Path $outputDir).Path
$installerScript = (Resolve-Path $installerScript).Path
$compileArgs = @(
"/DMyAppVersion=$version", "/DMyAppVersion=$version",
"/DPublishDir=..\$publishDir", "/DPublishDir=$publishDir",
"/DMyOutputDir=..\$outputDir", "/DMyOutputDir=$outputDir",
"/DMyAppArch=$arch", "/DMyAppArch=$arch",
"`"$installerScript`"" $installerScript
) -join " " )
Write-Host "Compile command: $compileCmd" Write-Host "Compile command: `"$isccPath`" $($compileArgs -join ' ')"
# Execute the compiler # Execute the compiler
$output = Invoke-Expression $compileCmd 2>&1 & $isccPath @compileArgs
Write-Host $output if ($LASTEXITCODE -ne 0) {
Write-Error "Inno Setup compiler exited with code $LASTEXITCODE"
exit 1
}
# Check if build was successful # Check if build was successful
$installerFile = Get-ChildItem -Path $outputDir -Filter "*.exe" -ErrorAction SilentlyContinue | Select-Object -First 1 $installerFile = Get-ChildItem -Path $outputDir -Filter "*.exe" -ErrorAction SilentlyContinue | Select-Object -First 1
@@ -172,6 +189,7 @@ jobs:
with: with:
name: release-windows-${{ matrix.arch }} name: release-windows-${{ matrix.arch }}
path: build-installer/*.exe path: build-installer/*.exe
if-no-files-found: error
retention-days: 30 retention-days: 30
build-linux: build-linux:
@@ -185,7 +203,7 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
submodules: recursive submodules: recursive
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref }} ref: ${{ needs.prepare.outputs.checkout_ref }}
- name: Install dependencies - name: Install dependencies
run: | run: |
@@ -287,6 +305,7 @@ EOF
with: with:
name: release-linux name: release-linux
path: "*.deb" path: "*.deb"
if-no-files-found: error
retention-days: 30 retention-days: 30
build-macos: build-macos:
@@ -303,7 +322,7 @@ EOF
with: with:
fetch-depth: 0 fetch-depth: 0
submodules: recursive submodules: recursive
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref }} ref: ${{ needs.prepare.outputs.checkout_ref }}
- name: Setup .NET - name: Setup .NET
uses: actions/setup-dotnet@v4 uses: actions/setup-dotnet@v4
@@ -409,12 +428,12 @@ EOF
with: with:
name: release-macos-${{ matrix.arch }} name: release-macos-${{ matrix.arch }}
path: "*.dmg" path: "*.dmg"
if-no-files-found: error
retention-days: 30 retention-days: 30
github-release: github-release:
needs: [ prepare, build-windows, build-linux, build-macos ] needs: [ prepare, build-windows, build-linux, build-macos ]
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions: permissions:
contents: write contents: write
@@ -446,12 +465,20 @@ EOF
ls -lh release-files/ || echo "⚠️ No files found in release-files" ls -lh release-files/ || echo "⚠️ No files found in release-files"
echo "" echo ""
echo "📋 Total files:" echo "📋 Total files:"
find release-files -type f | wc -l file_count=$(find release-files -type f | wc -l)
echo "$file_count"
if [ "$file_count" -eq 0 ]; then
echo "Error: No installer/package files found for release"
exit 1
fi
- name: Create Release - name: Create Release
uses: ncipollo/release-action@v1 uses: ncipollo/release-action@v1
with: with:
tag: ${{ github.ref_name }} tag: ${{ needs.prepare.outputs.tag }}
name: ${{ needs.prepare.outputs.tag }}
commit: ${{ github.sha }}
allowUpdates: true
draft: false draft: false
prerelease: ${{ github.event.inputs.is_prerelease == 'true' }} prerelease: ${{ github.event.inputs.is_prerelease == 'true' }}
artifacts: "release-files/**" artifacts: "release-files/**"

View File

@@ -23,38 +23,24 @@
<Image x:Name="ArtworkImage" <Image x:Name="ArtworkImage"
Stretch="UniformToFill" /> Stretch="UniformToFill" />
<Border x:Name="ImageBottomShade"
VerticalAlignment="Bottom"
Height="132">
<Border.Background>
<LinearGradientBrush StartPoint="0,0"
EndPoint="0,1">
<GradientStop Color="#00000000"
Offset="0" />
<GradientStop Color="#AF000000"
Offset="1" />
</LinearGradientBrush>
</Border.Background>
</Border>
<StackPanel x:Name="DateInfoStack" <StackPanel x:Name="DateInfoStack"
VerticalAlignment="Bottom" VerticalAlignment="Bottom"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Margin="22,0,0,22" Margin="18,0,0,16"
Spacing="2"> Spacing="2">
<TextBlock x:Name="DateTextBlock" <TextBlock x:Name="DateTextBlock"
Text="03/03" Text="03/03"
Foreground="#F9F9F9" Foreground="#F9F9F9"
FontSize="52" FontSize="44"
FontWeight="Bold" FontWeight="Bold"
FontFeatures="tnum" FontFeatures="tnum"
LineHeight="54" /> LineHeight="46" />
<TextBlock x:Name="WeekdayTextBlock" <TextBlock x:Name="WeekdayTextBlock"
Text="星期二" Text="星期二"
Foreground="#F9F9F9" Foreground="#F9F9F9"
FontSize="52" FontSize="44"
FontWeight="Bold" FontWeight="Bold"
LineHeight="54" /> LineHeight="46" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</Border> </Border>

View File

@@ -98,14 +98,12 @@ public partial class DailyArtworkWidget : UserControl, IDesktopComponentWidget,
Math.Clamp(14 * scale, 8, 22)); Math.Clamp(14 * scale, 8, 22));
DateInfoStack.Margin = new Thickness( DateInfoStack.Margin = new Thickness(
Math.Clamp(22 * scale, 10, 36), Math.Clamp(18 * scale, 8, 30),
0, 0,
0, 0,
Math.Clamp(20 * scale, 10, 34)); Math.Clamp(16 * scale, 8, 26));
DateInfoStack.Spacing = Math.Clamp(2 * scale, 1, 6); DateInfoStack.Spacing = Math.Clamp(2 * scale, 1, 6);
ImageBottomShade.Height = Math.Clamp(132 * scale, 64, 182);
StatusTextBlock.FontSize = Math.Clamp(16 * scale, 10, 24); StatusTextBlock.FontSize = Math.Clamp(16 * scale, 10, 24);
BrickPatternCanvas.Opacity = Math.Clamp(0.44 * scale, 0.20, 0.50); BrickPatternCanvas.Opacity = Math.Clamp(0.44 * scale, 0.20, 0.50);
@@ -387,28 +385,28 @@ public partial class DailyArtworkWidget : UserControl, IDesktopComponentWidget,
var leftPanelWidth = Math.Max(84, totalWidth - rightPanelWidth); var leftPanelWidth = Math.Max(84, totalWidth - rightPanelWidth);
var leftContentWidth = Math.Max(52, leftPanelWidth - DateInfoStack.Margin.Left - 10); var leftContentWidth = Math.Max(52, leftPanelWidth - DateInfoStack.Margin.Left - 10);
var dateBase = Math.Clamp(52 * scale, 18, 72); var dateBase = Math.Clamp(44 * scale, 16, 62);
DateTextBlock.FontSize = FitFontSize( DateTextBlock.FontSize = FitFontSize(
DateTextBlock.Text, DateTextBlock.Text,
leftContentWidth, leftContentWidth,
Math.Max(22, totalHeight * 0.22), Math.Max(18, totalHeight * 0.20),
maxLines: 1, maxLines: 1,
minFontSize: Math.Max(14, dateBase * 0.70), minFontSize: Math.Max(12, dateBase * 0.68),
maxFontSize: dateBase, maxFontSize: dateBase,
weight: FontWeight.Bold, weight: FontWeight.Bold,
lineHeightFactor: 1.02); lineHeightFactor: 1.00);
DateTextBlock.LineHeight = DateTextBlock.FontSize * 1.02; DateTextBlock.LineHeight = DateTextBlock.FontSize * 1.00;
WeekdayTextBlock.FontSize = FitFontSize( WeekdayTextBlock.FontSize = FitFontSize(
WeekdayTextBlock.Text, WeekdayTextBlock.Text,
leftContentWidth, leftContentWidth,
Math.Max(22, totalHeight * 0.24), Math.Max(18, totalHeight * 0.21),
maxLines: 1, maxLines: 1,
minFontSize: Math.Max(14, dateBase * 0.70), minFontSize: Math.Max(12, dateBase * 0.68),
maxFontSize: dateBase, maxFontSize: dateBase,
weight: FontWeight.Bold, weight: FontWeight.Bold,
lineHeightFactor: 1.03); lineHeightFactor: 1.00);
WeekdayTextBlock.LineHeight = WeekdayTextBlock.FontSize * 1.03; WeekdayTextBlock.LineHeight = WeekdayTextBlock.FontSize * 1.00;
var titleBase = Math.Clamp(44 * scale, 16, 58); var titleBase = Math.Clamp(44 * scale, 16, 58);
PaintingTitleTextBlock.MaxWidth = rightContentWidth; PaintingTitleTextBlock.MaxWidth = rightContentWidth;