Skip to content

Commit 822292f

Browse files
committed
feat: Add Inno Setup scripts for slim and self-contained installers, and a GitHub Actions workflow for automated releases, alongside minor application code adjustments.
1 parent 86f2e50 commit 822292f

21 files changed

Lines changed: 157 additions & 45 deletions

.github/workflows/release.yml

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,27 @@ jobs:
2424
- name: Restore
2525
run: dotnet restore
2626

27-
- name: Publish Slim binaries (x64/x86)
27+
- name: Publish Slim binaries (x64)
2828
shell: pwsh
2929
run: |
3030
dotnet publish StickyNote.csproj -c Release -r win-x64 /p:PublishSingleFile=true /p:SelfContained=false -o publish-slim/win-x64
31-
dotnet publish StickyNote.csproj -c Release -r win-x86 /p:PublishSingleFile=true /p:SelfContained=false -o publish-slim/win-x86
3231
33-
- name: Publish Self-contained binaries (x64/x86)
32+
- name: Publish Self-contained binaries (x64)
3433
shell: pwsh
3534
run: |
3635
dotnet publish StickyNote.csproj -c Release -r win-x64 /p:PublishSingleFile=true /p:SelfContained=true /p:IncludeNativeLibrariesForSelfExtract=true -o publish-sc/win-x64
37-
dotnet publish StickyNote.csproj -c Release -r win-x86 /p:PublishSingleFile=true /p:SelfContained=true /p:IncludeNativeLibrariesForSelfExtract=true -o publish-sc/win-x86
3836
3937
- name: Install Inno Setup
4038
shell: pwsh
4139
run: |
4240
choco install innosetup -y
4341
44-
- name: Compile installers (Slim & Full x64/x86)
42+
- name: Compile installers (Slim & Full x64)
4543
shell: pwsh
4644
run: |
4745
$iscc = "${env:ProgramFiles(x86)}\Inno Setup 6\iscc.exe"
4846
& $iscc 'installer\StickyNote_slim.iss' /DArch=x64
49-
& $iscc 'installer\StickyNote_slim.iss' /DArch=x86
5047
& $iscc 'installer\StickyNote_sc.iss' /DArch=x64
51-
& $iscc 'installer\StickyNote_sc.iss' /DArch=x86
5248
5349
- name: Upload installers artifact
5450
uses: actions/upload-artifact@v4
@@ -80,16 +76,6 @@ jobs:
8076
asset_name: StickyNote_Setup_Slim_x64.exe
8177
asset_content_type: application/octet-stream
8278

83-
- name: Upload asset Slim x86
84-
if: startsWith(github.ref, 'refs/tags/')
85-
uses: actions/upload-release-asset@v1
86-
env:
87-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88-
with:
89-
upload_url: ${{ steps.create_release.outputs.upload_url }}
90-
asset_path: installer/out/StickyNote_Setup_Slim_x86.exe
91-
asset_name: StickyNote_Setup_Slim_x86.exe
92-
asset_content_type: application/octet-stream
9379

9480
- name: Upload asset Full x64
9581
if: startsWith(github.ref, 'refs/tags/')
@@ -102,13 +88,3 @@ jobs:
10288
asset_name: StickyNote_Setup_x64.exe
10389
asset_content_type: application/octet-stream
10490

105-
- name: Upload asset Full x86
106-
if: startsWith(github.ref, 'refs/tags/')
107-
uses: actions/upload-release-asset@v1
108-
env:
109-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110-
with:
111-
upload_url: ${{ steps.create_release.outputs.upload_url }}
112-
asset_path: installer/out/StickyNote_Setup_x86.exe
113-
asset_name: StickyNote_Setup_x86.exe
114-
asset_content_type: application/octet-stream

NoteData.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class NoteData
2424
public bool IsUnderline { get; set; }
2525
public bool IsStrikethrough { get; set; }
2626
public string Alignment { get; set; } = "Left";
27+
public bool IsCustomTitle { get; set; } = false;
2728

2829
// P1: 纯文本预览缓存(不序列化,运行时生成)
2930
[JsonIgnore]

StickyForm.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -483,10 +483,13 @@ private void SaveCurrentNote()
483483
_current.FontSize = _rtb.Font.Size;
484484
// P1: 更新预览缓存
485485
_current.PlainPreview = TabPanel.BuildPreview(_current.Content);
486-
// 标题取第一行
487-
string firstLine = _rtb.Lines.Length > 0 ? _rtb.Lines[0] : "便签";
488-
if (firstLine.Length > 15) firstLine = firstLine[..15] + "…";
489-
_current.Title = string.IsNullOrWhiteSpace(firstLine) ? "便签" : firstLine;
486+
// 标题取第一行 (如果不是自定义标题)
487+
if (!_current.IsCustomTitle)
488+
{
489+
string firstLine = _rtb.Lines.Length > 0 ? _rtb.Lines[0] : "便签";
490+
if (firstLine.Length > 15) firstLine = firstLine[..15] + "…";
491+
_current.Title = string.IsNullOrWhiteSpace(firstLine) ? "便签" : firstLine;
492+
}
490493
_tabPanel.UpdateNote(_current);
491494
_titleBar.Invalidate(); // U1: 更新标题
492495
ScheduleSave();
@@ -521,6 +524,7 @@ private void OnTabRenameRequested(object? s, NoteData note)
521524
string? newName = InputDialog("重命名", "标签名称:", note.Title);
522525
if (newName == null) return;
523526
note.Title = newName.Trim();
527+
note.IsCustomTitle = true;
524528
NoteManager.SaveNotes();
525529
_tabPanel.SetNotes(_notes, _current);
526530
}
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
1.01 KB
Binary file not shown.

build_installers.ps1

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,17 @@ Write-Host "Found Inno Setup: $ISCC" -ForegroundColor Green
3030
# 1. Publish Slim versions
3131
Write-Host "`n=== Publishing Slim Versions ===" -ForegroundColor Cyan
3232
dotnet publish StickyNote.csproj -c Release -r win-x64 /p:PublishSingleFile=true /p:SelfContained=false -o publish-slim/win-x64
33-
dotnet publish StickyNote.csproj -c Release -r win-x86 /p:PublishSingleFile=true /p:SelfContained=false -o publish-slim/win-x86
3433

3534
# 2. Publish Self-contained versions
3635
Write-Host "`n=== Publishing Self-contained Versions ===" -ForegroundColor Cyan
3736
dotnet publish StickyNote.csproj -c Release -r win-x64 /p:PublishSingleFile=true /p:SelfContained=true /p:IncludeNativeLibrariesForSelfExtract=true -o publish-sc/win-x64
38-
dotnet publish StickyNote.csproj -c Release -r win-x86 /p:PublishSingleFile=true /p:SelfContained=true /p:IncludeNativeLibrariesForSelfExtract=true -o publish-sc/win-x86
3937

4038
# 3. Compile Installers
4139
Write-Host "`n=== Compiling Installers ===" -ForegroundColor Cyan
4240

4341
$installers = @(
4442
@{ Script = "installer\StickyNote_slim.iss"; Arch = "x64" },
45-
@{ Script = "installer\StickyNote_slim.iss"; Arch = "x86" },
46-
@{ Script = "installer\StickyNote_sc.iss"; Arch = "x64" },
47-
@{ Script = "installer\StickyNote_sc.iss"; Arch = "x86" }
43+
@{ Script = "installer\StickyNote_sc.iss"; Arch = "x64" }
4844
)
4945

5046
foreach ($inst in $installers) {

installer/StickyNote_sc.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#define AppName "StickyNote"
2-
#define AppVersion "1.4.0"
2+
#define AppVersion "1.5.0"
33
#define AppPublisher "StickyNote"
44
#define AppURL "https://example.invalid/StickyNote"
55
#define AppExe "StickyNote.exe"

installer/StickyNote_slim.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#define AppName "StickyNote"
2-
#define AppVersion "1.4.0"
2+
#define AppVersion "1.5.0"
33
#define AppPublisher "StickyNote"
44
#define AppURL "https://example.invalid/StickyNote"
55
#define AppExe "StickyNote.exe"

obj/Debug/net8.0-windows/StickyNote.AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
[assembly: System.Reflection.AssemblyCompanyAttribute("StickyNote")]
1414
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
1515
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.5.0")]
16-
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.5.0+fdecd6739c705d09dc87c00a4d724d4b362a13f8")]
16+
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.5.0+86f2e504ac16835e5c61acef60076f6980fe95f5")]
1717
[assembly: System.Reflection.AssemblyProductAttribute("StickyNote")]
1818
[assembly: System.Reflection.AssemblyTitleAttribute("StickyNote")]
1919
[assembly: System.Reflection.AssemblyVersionAttribute("1.5.0")]

0 commit comments

Comments
 (0)