From d32fb898ebdca8e6d19a6b621cf6768e5ae661c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B8=AD=E9=B8=AD=E3=80=8C=E3=82=AB=E3=83=A2=E3=80=8D?= <89643991+DuckDuckStudio@users.noreply.github.com> Date: Tue, 23 Jun 2026 01:58:27 +0800 Subject: [PATCH 1/9] =?UTF-8?q?ci(build):=20=E7=BB=9F=E4=B8=80=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=20pwsh=20shell?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yaml | 37 ++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 41d1cd5..1e4a7c5 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -8,7 +8,7 @@ on: required: true default: 2.3.3 release: - types: [ published ] + types: [published] permissions: contents: write @@ -29,6 +29,7 @@ jobs: python-version: 3.x - name: 更新版本号 + shell: pwsh env: PYTHONIOENCODING: utf-8 GITHUB_EVENT_INPUTS_VERSION: ${{ github.event.inputs.version }} @@ -77,34 +78,34 @@ jobs: # 整理文件 > 压缩文件 > 清理工作目录 env: PYTHONIOENCODING: utf-8 - shell: bash + shell: pwsh run: |- - cp -v LICENSE src/LICENSE - mkdir Release - mkdir Release/src - cp -rv src/ Release - cp -v LICENSE Release/src - cp -v requirements.txt Release/src + Copy-Item -Path "LICENSE" -Destination "src/LICENSE" -Verbose + New-Item -ItemType Directory -Path "Release" -Verbose + New-Item -ItemType Directory -Path "Release/src" -Verbose + Copy-Item -Recurse -Path "src/*" -Destination "Release/src" + Copy-Item -Path "LICENSE" -Destination "Release/src" -Verbose + Copy-Item -Path "requirements.txt" -Destination "Release/src" -Verbose # 压缩源码到 Release,7z 和 zip 7z a -t7z Release/Sundry-src.7z Release/src 7z a -tzip Release/Sundry-src.zip Release/src - name: 制作安装程序和打包后的压缩包 - shell: bash + shell: pwsh env: PYTHONIOENCODING: utf-8 # 这里是直接打包过去的,不用管 sundry.ps1 run: |- - mkdir Release/pack - cp -v src/fun.txt Release/pack - cp -v LICENSE Release/pack - echo ======================================== + New-Item -ItemType Directory -Path "Release/pack" -Verbose + Copy-Item -Path "src/fun.txt" -Destination "Release/pack" -Verbose + Copy-Item -Path "LICENSE" -Destination "Release/pack" -Verbose + Write-Host "========================================" python "自动化脚本/png-2-ico.py" pyinstaller --onefile --distpath="Release/pack" --name="sundry.exe" "src/sundry.py" --upx-dir="upx" -i "icon/Sundry.ico" - echo ======================================== + Write-Host "========================================" 7z a -t7z Release/Sundry.7z Release/pack 7z a -tzip Release/Sundry.zip Release/pack - echo ======================================== + Write-Host "========================================" curl -o "C:\Program Files (x86)\Inno Setup 6\Languages\ChineseSimplified.isl" "https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/ChineseSimplified.isl" iscc installer.iss @@ -117,10 +118,10 @@ jobs: - name: 整理发行版文件 if: ${{ github.event_name != 'workflow_dispatch' }} - shell: bash + shell: pwsh run: |- - rm -rv Release/pack - rm -rv Release/src + Remove-Item -Recurse "Release/pack" -Verbose + Remove-Item -Recurse "Release/src" -Verbose - name: 发布至发行版 if: ${{ github.event_name != 'workflow_dispatch' }} From cb6c7e09fc4b337c4753389e673fec17c22a6ee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B8=AD=E9=B8=AD=E3=80=8C=E3=82=AB=E3=83=A2=E3=80=8D?= <89643991+DuckDuckStudio@users.noreply.github.com> Date: Tue, 23 Jun 2026 02:22:32 +0800 Subject: [PATCH 2/9] =?UTF-8?q?ci(build):=20=E5=B0=86=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E5=8F=91=E8=A1=8C=E7=89=88=E7=9A=84=E6=AD=A5=E9=AA=A4=E6=8B=86?= =?UTF-8?q?=E5=88=B0=E4=B8=80=E4=B8=AA=E5=8D=95=E7=8B=AC=E7=9A=84=20job=20?= =?UTF-8?q?=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yaml | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1e4a7c5..1bf2f3b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -10,11 +10,11 @@ on: release: types: [published] -permissions: - contents: write +permissions: {} jobs: build: + name: 构建安装程序和压缩包 runs-on: windows-latest steps: @@ -110,21 +110,34 @@ jobs: iscc installer.iss - name: 上传构建文件 - if: ${{ github.event_name == 'workflow_dispatch' }} uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: Release path: Release/** - - name: 整理发行版文件 - if: ${{ github.event_name != 'workflow_dispatch' }} + publish: + name: 发布发行版 + needs: build + runs-on: windows-latest + if: ${{ github.event_name == 'release' }} + + permissions: + contents: write # 发布发行版 + + steps: + - name: 下载构建文件 + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: Release + path: Release + + - name: 移除中间产物 shell: pwsh run: |- Remove-Item -Recurse "Release/pack" -Verbose Remove-Item -Recurse "Release/src" -Verbose - name: 发布至发行版 - if: ${{ github.event_name != 'workflow_dispatch' }} uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0 with: files: Release/** From 00c2d928366ec89da6496bd328fa1eea35d7d876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B8=AD=E9=B8=AD=E3=80=8C=E3=82=AB=E3=83=A2=E3=80=8D?= <89643991+DuckDuckStudio@users.noreply.github.com> Date: Tue, 23 Jun 2026 02:25:33 +0800 Subject: [PATCH 3/9] =?UTF-8?q?ci(build):=20=E6=9B=B4=E6=B8=85=E6=99=B0?= =?UTF-8?q?=E7=9A=84=E5=B7=A5=E4=BD=9C=E6=B5=81=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1bf2f3b..566e77a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,4 +1,4 @@ -name: Pack Releases +name: 发布和构建 on: workflow_dispatch: From 520ab1ffc4510129a5cf61a835dd69df24d59eea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B8=AD=E9=B8=AD=E3=80=8C=E3=82=AB=E3=83=A2=E3=80=8D?= <89643991+DuckDuckStudio@users.noreply.github.com> Date: Tue, 23 Jun 2026 03:47:21 +0800 Subject: [PATCH 4/9] =?UTF-8?q?ci(build):=20=E7=9B=B4=E6=8E=A5=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=20gh=20release=20upload=20=E4=B8=8A=E4=BC=A0=E5=8F=91?= =?UTF-8?q?=E8=A1=8C=E7=89=88=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 566e77a..9f11a6b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -138,6 +138,6 @@ jobs: Remove-Item -Recurse "Release/src" -Verbose - name: 发布至发行版 - uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0 - with: - files: Release/** + env: + GH_TOKEN: ${{ github.token }} + run: gh release upload "$env:GITHUB_REF_NAME" "Release/*" From ef379f2786cd759986444dbd3039036d10eacfba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B8=AD=E9=B8=AD=E3=80=8C=E3=82=AB=E3=83=A2=E3=80=8D?= <89643991+DuckDuckStudio@users.noreply.github.com> Date: Tue, 23 Jun 2026 04:39:40 +0800 Subject: [PATCH 5/9] =?UTF-8?q?chore(iss):=20=E7=A7=BB=E9=99=A4=E5=A4=9A?= =?UTF-8?q?=E4=BD=99=E7=9A=84=20`Flags:=20recursesubdirs`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- installer.iss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer.iss b/installer.iss index 20a699f..dd6143f 100644 --- a/installer.iss +++ b/installer.iss @@ -22,7 +22,7 @@ Name: "chinesesimplified"; MessagesFile: "compiler:Languages\ChineseSimplified.i Name: "japanese"; MessagesFile: "compiler:Languages\Japanese.isl" [Files] -Source: "Release\pack\*"; DestDir: "{app}"; Flags: recursesubdirs +Source: "Release\pack\*"; DestDir: "{app}"; [Run] Filename: "{sys}\cmd.exe"; Parameters: "/C setx PATH ""{app};%PATH%"" /M"; Flags: runhidden From 8235052eb7dc116c6d50ff5f3d4c4233d1876b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B8=AD=E9=B8=AD=E3=80=8C=E3=82=AB=E3=83=A2=E3=80=8D?= <89643991+DuckDuckStudio@users.noreply.github.com> Date: Tue, 23 Jun 2026 04:49:26 +0800 Subject: [PATCH 6/9] =?UTF-8?q?ci(build):=20=E6=9B=B4=E6=96=B0=E5=8E=8B?= =?UTF-8?q?=E7=BC=A9=E5=91=BD=E4=BB=A4=E4=BB=A5=E5=8E=BB=E9=99=A4=E5=A4=9A?= =?UTF-8?q?=E4=BD=99=E7=9B=AE=E5=BD=95=E5=B5=8C=E5=A5=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 9f11a6b..7589470 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -87,8 +87,8 @@ jobs: Copy-Item -Path "LICENSE" -Destination "Release/src" -Verbose Copy-Item -Path "requirements.txt" -Destination "Release/src" -Verbose # 压缩源码到 Release,7z 和 zip - 7z a -t7z Release/Sundry-src.7z Release/src - 7z a -tzip Release/Sundry-src.zip Release/src + 7z a -t7z Release/Sundry-src.7z ./Release/src/* + 7z a -tzip Release/Sundry-src.zip ./Release/src/* - name: 制作安装程序和打包后的压缩包 shell: pwsh @@ -103,8 +103,8 @@ jobs: python "自动化脚本/png-2-ico.py" pyinstaller --onefile --distpath="Release/pack" --name="sundry.exe" "src/sundry.py" --upx-dir="upx" -i "icon/Sundry.ico" Write-Host "========================================" - 7z a -t7z Release/Sundry.7z Release/pack - 7z a -tzip Release/Sundry.zip Release/pack + 7z a -t7z Release/Sundry.7z ./Release/pack/* + 7z a -tzip Release/Sundry.zip ./Release/pack/* Write-Host "========================================" curl -o "C:\Program Files (x86)\Inno Setup 6\Languages\ChineseSimplified.isl" "https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/ChineseSimplified.isl" iscc installer.iss From 4543357275b1b2ea6dc1ac7bd010fadfd0bda549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B8=AD=E9=B8=AD=E3=80=8C=E3=82=AB=E3=83=A2=E3=80=8D?= <89643991+DuckDuckStudio@users.noreply.github.com> Date: Wed, 24 Jun 2026 08:32:54 +0800 Subject: [PATCH 7/9] =?UTF-8?q?ci(build):=20=E4=BB=8E=E6=96=B0=20url=20?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=20ChineseSimplified.isl=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E5=93=88=E5=B8=8C=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 这是一个临时的操作,依据他们的 https://github.com/jrsoftware/issrc/blob/main/whatsnew.htm,他们会在下个版本发布带有官方中文翻译的 Inno Setup。 --- .github/workflows/build.yaml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7589470..d4615d5 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -106,7 +106,24 @@ jobs: 7z a -t7z Release/Sundry.7z ./Release/pack/* 7z a -tzip Release/Sundry.zip ./Release/pack/* Write-Host "========================================" - curl -o "C:\Program Files (x86)\Inno Setup 6\Languages\ChineseSimplified.isl" "https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/ChineseSimplified.isl" + if ((Get-Date) -le (Get-Date "2026-06-29")) { + Write-Host "通过 GitHub API 下载中文翻译..." + $apiUrl = "https://api.github.com/repos/jrsoftware/issrc/contents/Files/Languages/ChineseSimplified.isl?ref=main" + $downloadPath = "C:\Program Files (x86)\Inno Setup 6\Languages\ChineseSimplified.isl" + Invoke-WebRequest -Uri $apiUrl -Headers @{ "Accept" = "application/vnd.github.raw+json" } -OutFile $downloadPath + + Write-Host "校验下载文件哈希值..." + $expected = "8131FB1DB160E9502889351FA524D1BF693E231EBC90C8D9C1460056663B6450" + $actual = (Get-FileHash -Path $downloadPath -Algorithm SHA256).Hash.ToUpper() + if ($actual -ne $expected.ToUpper()) { + Write-Error "SHA256 哈希值不匹配\n预期: $expected\n实际: $actual" + exit -2145099774 + } + Write-Host "哈希值校验成功" + } else { + Write-Error "Inno Setup 7.0.2 应该今天会发布,请使用包含官方翻译的新版本" + exit -1 + } iscc installer.iss - name: 上传构建文件 From 42caed50393cf01a3db4f1cc7c600b4aa0949466 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B8=AD=E9=B8=AD=E3=80=8C=E3=82=AB=E3=83=A2=E3=80=8D?= <89643991+DuckDuckStudio@users.noreply.github.com> Date: Thu, 25 Jun 2026 02:59:30 +0800 Subject: [PATCH 8/9] =?UTF-8?q?ci(build):=20=E5=B0=86=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=8F=98=E9=87=8F=20`PYTHONIOENCODING:=20utf-8`=20=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E6=8F=90=E5=8D=87=E8=87=B3=E5=B7=A5=E4=BD=9C=E6=B5=81?= =?UTF-8?q?=E7=BA=A7=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [步骤级别](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idstepsenv) → [工作流级别](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#env) 反正这个环境变量需要 Python 的步骤都需要,对其他步骤也没有负面影响,还不如直接工作流级别定义一次,还能避免在步骤级别忘记写。 --- .github/workflows/build.yaml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d4615d5..9031132 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -12,6 +12,9 @@ on: permissions: {} +env: + PYTHONIOENCODING: utf-8 + jobs: build: name: 构建安装程序和压缩包 @@ -31,7 +34,6 @@ jobs: - name: 更新版本号 shell: pwsh env: - PYTHONIOENCODING: utf-8 GITHUB_EVENT_INPUTS_VERSION: ${{ github.event.inputs.version }} # 前面已经配置过 Python 了,这个脚本只用 os 和 sys 这两个标准库,不用再装依赖 run: |- @@ -57,8 +59,6 @@ jobs: - name: 安装依赖 shell: pwsh - env: - PYTHONIOENCODING: utf-8 # 环境配置的依赖文件中含有打包所需依赖 run: |- pip install -r "requirements.txt" @@ -76,8 +76,6 @@ jobs: - name: 整理源码 # 整理文件 > 压缩文件 > 清理工作目录 - env: - PYTHONIOENCODING: utf-8 shell: pwsh run: |- Copy-Item -Path "LICENSE" -Destination "src/LICENSE" -Verbose @@ -92,8 +90,6 @@ jobs: - name: 制作安装程序和打包后的压缩包 shell: pwsh - env: - PYTHONIOENCODING: utf-8 # 这里是直接打包过去的,不用管 sundry.ps1 run: |- New-Item -ItemType Directory -Path "Release/pack" -Verbose From 2c9aabca0e0266da0b67211645ab56d29901999c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B8=AD=E9=B8=AD=E3=80=8C=E3=82=AB=E3=83=A2=E3=80=8D?= <89643991+DuckDuckStudio@users.noreply.github.com> Date: Thu, 25 Jun 2026 04:55:59 +0800 Subject: [PATCH 9/9] =?UTF-8?q?ci(build):=20=E7=BB=86=E6=8B=86=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E5=8F=91=E8=A1=8C=E6=96=87=E4=BB=B6=E7=9A=84=E6=AD=A5?= =?UTF-8?q?=E9=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yaml | 42 +++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 9031132..a7f970b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -74,34 +74,49 @@ jobs: Remove-Item "upx-latest.zip" -Verbose tree /a /f - - name: 整理源码 - # 整理文件 > 压缩文件 > 清理工作目录 + - name: 整理文件到 Release 文件夹 shell: pwsh run: |- - Copy-Item -Path "LICENSE" -Destination "src/LICENSE" -Verbose + # 创建文件夹 New-Item -ItemType Directory -Path "Release" -Verbose New-Item -ItemType Directory -Path "Release/src" -Verbose - Copy-Item -Recurse -Path "src/*" -Destination "Release/src" + New-Item -ItemType Directory -Path "Release/pack" -Verbose + + # 复制许可文件 Copy-Item -Path "LICENSE" -Destination "Release/src" -Verbose + Copy-Item -Path "LICENSE" -Destination "Release/pack" -Verbose + + # 复制源码需要的需求文件和项目配置 Copy-Item -Path "requirements.txt" -Destination "Release/src" -Verbose - # 压缩源码到 Release,7z 和 zip + Copy-Item -Path "pyproject.toml" -Destination "Release/src" -Verbose + + # 复制源码 + Copy-Item -Recurse -Path "src/*" -Destination "Release/src" + + # 复制 fun.txt + Copy-Item -Path "src/fun.txt" -Destination "Release/pack" -Verbose + + - name: 创建源码归档 + shell: pwsh + run: |- 7z a -t7z Release/Sundry-src.7z ./Release/src/* 7z a -tzip Release/Sundry-src.zip ./Release/src/* - - name: 制作安装程序和打包后的压缩包 + - name: 构建 Sundry shell: pwsh - # 这里是直接打包过去的,不用管 sundry.ps1 run: |- - New-Item -ItemType Directory -Path "Release/pack" -Verbose - Copy-Item -Path "src/fun.txt" -Destination "Release/pack" -Verbose - Copy-Item -Path "LICENSE" -Destination "Release/pack" -Verbose - Write-Host "========================================" python "自动化脚本/png-2-ico.py" pyinstaller --onefile --distpath="Release/pack" --name="sundry.exe" "src/sundry.py" --upx-dir="upx" -i "icon/Sundry.ico" - Write-Host "========================================" + + - name: 创建构建结果归档 + shell: pwsh + run: |- 7z a -t7z Release/Sundry.7z ./Release/pack/* 7z a -tzip Release/Sundry.zip ./Release/pack/* - Write-Host "========================================" + + - name: 打包安装程序 + shell: pwsh + run: |- if ((Get-Date) -le (Get-Date "2026-06-29")) { Write-Host "通过 GitHub API 下载中文翻译..." $apiUrl = "https://api.github.com/repos/jrsoftware/issrc/contents/Files/Languages/ChineseSimplified.isl?ref=main" @@ -120,6 +135,7 @@ jobs: Write-Error "Inno Setup 7.0.2 应该今天会发布,请使用包含官方翻译的新版本" exit -1 } + iscc installer.iss - name: 上传构建文件