Skip to content

[Bug] 修复当 i["end"] - i["start"] 等于 0 时,会发生除零错误,导致程序崩溃的问题 #17

[Bug] 修复当 i["end"] - i["start"] 等于 0 时,会发生除零错误,导致程序崩溃的问题

[Bug] 修复当 i["end"] - i["start"] 等于 0 时,会发生除零错误,导致程序崩溃的问题 #17

Workflow file for this run

name: Build Windows
on:
workflow_dispatch:
inputs:
package_installer:
description: 'Package Installer'
required: true
default: 'true'
type: choice
options:
- 'true'
- 'false'
sign_artifact:
description: 'Sign Artifact'
required: true
default: 'true'
type: choice
options:
- 'true'
- 'false'
jobs:
build-windows:
strategy:
matrix:
architecture: [x86_64, arm64]
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install --timeout=300 -r requirements.txt
- name: Build with Nuitka
shell: pwsh
run: |
# 将需要在 runner 上执行的 Python 逻辑写入临时文件(避免复杂的命令行引号/转义问题)
@'
from app.common.config import VERSION

Check failure on line 49 in .github/workflows/build_Windows.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/build_Windows.yml

Invalid workflow file

You have an error in your yaml syntax on line 49
# 将版本写入 version.txt 以便后续 PowerShell 读取
with open("version.txt", "w", encoding="utf-8") as f:
f.write(VERSION)
# 如果你原先的 python -c 还做了对 .iss 的替换或其他修改,
# 请把这些逻辑也放在这里或保留 deploy.py 来完成
'@ | Out-File -FilePath get_version.py -Encoding utf8
python get_version.py
# 读取 version.txt(使用 -Raw 保留整行,不产生数组)
$VERSION = Get-Content version.txt -Raw
Write-Host "VERSION=$VERSION"
# 将 VERSION 写入 GitHub Actions 环境文件(推荐用 Add-Content)
Add-Content -Path $env:GITHUB_ENV -Value "VERSION=$VERSION"
# 清理临时文件
Remove-Item get_version.py, version.txt -ErrorAction SilentlyContinue
# 继续原有部署步骤
python deploy.py
- name: Prepare For Sign
if: ${{ github.event.inputs.sign_artifact == 'true' }}
run: |
mv dist/Ghost-Downloader-3.dist dist/Ghost-Downloader-3-Unsigned.dist
- name: upload-unsigned-artifact
if: ${{ github.event.inputs.sign_artifact == 'true' }}
id: upload-unsigned-artifact
uses: actions/upload-artifact@v4
with:
name: Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}-Unsigned
path: dist/Ghost-Downloader-3-Unsigned.dist
- name: Debug upload-artifact outputs
if: ${{ github.event.inputs.sign_artifact == 'true' }}
shell: pwsh
run: |
Write-Host "Full step object (toJson):"
Write-Host '${{ toJson(steps.upload-unsigned-artifact) }}'
Write-Host "outputs.artifact-id:"
Write-Host '${{ steps.upload-unsigned-artifact.outputs.artifact-id }}'
Write-Host "outputs.artifact_id:"
Write-Host '${{ steps.upload-unsigned-artifact.outputs.artifact_id }}'
- name: Sign
if: ${{ github.event.inputs.sign_artifact == 'true' }}
uses: signpath/[email protected]
with:
api-token: ${{ secrets.SIGNPATH_API_TOKEN }}
organization-id: ${{ secrets.SIGNPATH_ORGANIZATION_ID }}
project-slug: 'Ghost-Downloader-3'
signing-policy-slug: 'release-signing'
github-artifact-id: ${{ steps.upload-unsigned-artifact.outputs.artifact-id }}
wait-for-completion: true
output-artifact-directory: 'dist/Ghost-Downloader-3.dist'
- name: Download Inno Setup Translation Files
if: ${{ github.event.inputs.package_installer == 'true' }}
run: |
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/ChineseSimplified.isl" -OutFile "C:\Program Files (x86)\Inno Setup 6\Languages\ChineseSimplified.isl"
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/ChineseTraditional.isl" -OutFile "C:\Program Files (x86)\Inno Setup 6\Languages\ChineseTraditional.isl"
- name: Build Installer
if: ${{ github.event.inputs.package_installer == 'true' }}
uses: Minionguyjpro/[email protected]
with:
path: Ghost-Downloader-3.iss
- name: Rename Installer
if: ${{ github.event.inputs.package_installer == 'true' }}
shell: pwsh
run: |
mv dist/Ghost-Downloader-v${{ env.VERSION }}-Windows-Setup.exe dist/Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}-Setup.exe
- name: Upload Installer
if: ${{ github.event.inputs.package_installer == 'true' }}
uses: actions/upload-artifact@v4
with:
name: Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}-Setup
path: dist/Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}-Setup.exe
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}
path: |
dist/Ghost-Downloader-3.dist