Skip to content

Commit 17a09b0

Browse files
committed
add: 文件整理桌面版与自动发布流程
0 parents  commit 17a09b0

51 files changed

Lines changed: 9429 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release.yml

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- 'v*'
9+
workflow_dispatch:
10+
inputs:
11+
tag:
12+
description: Release tag, for example v26.07.02
13+
required: true
14+
type: string
15+
16+
permissions:
17+
contents: write
18+
19+
jobs:
20+
windows-release:
21+
name: Build Windows exe and publish release
22+
runs-on: windows-latest
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Set up Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: 24
32+
33+
- name: Set up pnpm
34+
run: |
35+
corepack enable
36+
corepack prepare pnpm@11.7.0 --activate
37+
38+
- name: Install dependencies
39+
run: pnpm install --frozen-lockfile
40+
41+
- name: Run tests
42+
run: pnpm test
43+
44+
- name: Build desktop executable
45+
env:
46+
CSC_IDENTITY_AUTO_DISCOVERY: false
47+
run: pnpm run release:desktop
48+
49+
- name: Resolve release tag
50+
id: release
51+
shell: pwsh
52+
env:
53+
EVENT_NAME: ${{ github.event_name }}
54+
INPUT_TAG: ${{ inputs.tag }}
55+
REF_TYPE: ${{ github.ref_type }}
56+
REF_NAME: ${{ github.ref_name }}
57+
run: |
58+
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
59+
$OutputEncoding = [System.Text.Encoding]::UTF8
60+
$package = Get-Content package.json -Raw | ConvertFrom-Json
61+
if ($env:EVENT_NAME -eq 'workflow_dispatch' -and $env:INPUT_TAG) {
62+
$tag = $env:INPUT_TAG
63+
} elseif ($env:REF_TYPE -eq 'tag') {
64+
$tag = $env:REF_NAME
65+
} else {
66+
$tag = "v$($package.releaseVersion)"
67+
}
68+
69+
if (-not $tag.StartsWith('v')) {
70+
$tag = "v$tag"
71+
}
72+
73+
"tag=$tag" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
74+
"title=[FileOrganizer](https://github.com/cimorn/FileOrganizer)-$tag" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
75+
"sourceAssetName=文件整理-$tag.exe" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
76+
"assetName=FileOrganizer-$tag.exe" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
77+
78+
- name: Create or update GitHub release
79+
shell: pwsh
80+
env:
81+
GH_TOKEN: ${{ github.token }}
82+
RELEASE_TAG: ${{ steps.release.outputs.tag }}
83+
RELEASE_TITLE: ${{ steps.release.outputs.title }}
84+
SOURCE_ASSET_NAME: ${{ steps.release.outputs.sourceAssetName }}
85+
ASSET_NAME: ${{ steps.release.outputs.assetName }}
86+
run: |
87+
$ErrorActionPreference = 'Stop'
88+
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
89+
$OutputEncoding = [System.Text.Encoding]::UTF8
90+
$assetPath = Join-Path "dist" $env:SOURCE_ASSET_NAME
91+
if (-not (Test-Path -LiteralPath $assetPath)) {
92+
throw "Release asset not found: $assetPath"
93+
}
94+
95+
$headers = @{
96+
Authorization = "Bearer $env:GH_TOKEN"
97+
Accept = "application/vnd.github+json"
98+
"X-GitHub-Api-Version" = "2022-11-28"
99+
}
100+
$apiBase = "https://api.github.com/repos/$env:GITHUB_REPOSITORY"
101+
$release = $null
102+
103+
try {
104+
$release = Invoke-RestMethod -Headers $headers -Uri "$apiBase/releases/tags/$env:RELEASE_TAG"
105+
} catch {
106+
if ($_.Exception.Response.StatusCode.value__ -ne 404) {
107+
throw
108+
}
109+
}
110+
111+
if ($release) {
112+
foreach ($releaseAsset in $release.assets) {
113+
if ($releaseAsset.name.EndsWith('.exe')) {
114+
Invoke-RestMethod -Method Delete -Headers $headers -Uri "$apiBase/releases/assets/$($releaseAsset.id)"
115+
}
116+
}
117+
$release = Invoke-RestMethod `
118+
-Method Patch `
119+
-Headers $headers `
120+
-Uri "$apiBase/releases/$($release.id)" `
121+
-ContentType "application/json" `
122+
-Body (@{ name = $env:RELEASE_TITLE } | ConvertTo-Json)
123+
} else {
124+
$release = Invoke-RestMethod `
125+
-Method Post `
126+
-Headers $headers `
127+
-Uri "$apiBase/releases" `
128+
-ContentType "application/json" `
129+
-Body (@{
130+
tag_name = $env:RELEASE_TAG
131+
target_commitish = "${{ github.sha }}"
132+
name = $env:RELEASE_TITLE
133+
generate_release_notes = $true
134+
} | ConvertTo-Json)
135+
}
136+
137+
$encodedName = [System.Uri]::EscapeDataString($env:ASSET_NAME)
138+
Invoke-RestMethod `
139+
-Method Post `
140+
-Headers $headers `
141+
-Uri "https://uploads.github.com/repos/$env:GITHUB_REPOSITORY/releases/$($release.id)/assets?name=$encodedName" `
142+
-ContentType "application/octet-stream" `
143+
-InFile $assetPath

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
node_modules/
2+
dist/
3+
qa-output/
4+
5+
.env
6+
.env.*
7+
*.log
8+
9+
coverage/
10+
.vite/
11+
.turbo/
12+
13+
Thumbs.db
14+
Desktop.ini

CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# 更新日志
2+
3+
**中文** | [English](CHANGELOG_EN.md)
4+
5+
本文件记录文件整理的重要变更。
6+
7+
## [26.07.02] - 2026-07-02
8+
9+
### 新增
10+
11+
- 软件名称统一为 `文件整理`,英文说明中使用 `File Organizer`
12+
- 支持按时间线浏览图片、视频和普通文件。
13+
- 支持自定义批量改名模板,包括 `{yy}``{MM}``{dd}``{index}``{name}`
14+
- 支持移动和“改名并移动”的文件夹模板。
15+
- 支持 Excel 导出、导入和表格改名。
16+
- 支持通过 Excel 修改后缀;新后缀为空时保留原后缀。
17+
- 支持按固定间隔批量修改文件创建时间、修改时间和访问时间。
18+
- 支持按大小和 SHA-256 哈希查找重复文件。
19+
- 支持操作历史和撤销改名、移动操作。
20+
- 执行文件操作前会检测目标冲突。
21+
- 为首个开源候选版本生成产品检测报告。
22+
23+
### 调整
24+
25+
- 将 UI 统一调整为蓝色系。
26+
- 将搜索、文件类型、包含子文件夹、页面切换和 Excel 操作移到顶部工具栏。
27+
- 将批量操作按钮和目标文件夹选择放到右侧预览区域。
28+
- 将生成的 Windows exe 改名为 `dist\文件整理.exe`
29+
- 将项目元信息改为 `file-organizer``local.file-organizer``文件整理`
30+
31+
### 修复
32+
33+
- 修复打包后主进程路径错误导致的启动失败。
34+
- 修复顶部工具栏和空状态页面的排版问题。
35+
- 清理蓝色主题更新后残留的旧绿色样式。
36+
37+
### 已知说明
38+
39+
- 如果 Windows exe 正在运行,`pnpm run build:desktop` 可能因为 `dist\文件整理.exe` 被占用而失败。重新打包前请先关闭软件。
40+
- `package.json` 使用 `26.7.2`,因为 npm 包版本需要符合语义化版本规则。公开发布版本仍为 `26.07.02`

CHANGELOG_EN.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Changelog
2+
3+
[中文](CHANGELOG.md) | **English**
4+
5+
This file documents notable changes to File Organizer.
6+
7+
## [26.07.02] - 2026-07-02
8+
9+
### Added
10+
11+
- Unified the app name as `文件整理`, with `File Organizer` used in English documentation.
12+
- Added timeline browsing for photos, videos, and ordinary files.
13+
- Added custom batch rename templates, including `{yy}`, `{MM}`, `{dd}`, `{index}`, and `{name}`.
14+
- Added folder templates for move and rename-and-move operations.
15+
- Added Excel export, import, and spreadsheet-based rename workflows.
16+
- Added extension editing through Excel import. Empty new extension values keep the original extension.
17+
- Added batch editing for file creation, modified, and access times with configurable intervals.
18+
- Added duplicate file detection by size and SHA-256 hash.
19+
- Added operation history and undo support for completed rename and move operations.
20+
- Added conflict detection before file operations.
21+
- Added a product QA report for the first public release candidate.
22+
23+
### Changed
24+
25+
- Changed the visual theme to a blue color system.
26+
- Moved search, file type, recursive mode, page navigation, and Excel actions into the top toolbar.
27+
- Moved operation controls and destination folder selection into the right-side preview panel.
28+
- Renamed the generated Windows executable to `dist\文件整理.exe`.
29+
- Updated project metadata to `file-organizer`, `local.file-organizer`, and `文件整理`.
30+
31+
### Fixed
32+
33+
- Fixed a packaged app startup error caused by an incorrect main process path.
34+
- Fixed layout issues in the toolbar and empty state.
35+
- Removed old green theme remnants after the blue theme update.
36+
37+
### Known Notes
38+
39+
- If the Windows executable is running, `pnpm run build:desktop` may fail because Windows locks `dist\文件整理.exe`. Close the app before rebuilding.
40+
- `package.json` uses `26.7.2` because npm package versions must follow semantic version rules. The public release version remains `26.07.02`.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 File Organizer contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM,
20+
OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)