Skip to content

Commit cf1f253

Browse files
committed
fix: 打包流程修改
1 parent bc4a08d commit cf1f253

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

.github/workflows/release.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,21 @@ jobs:
2121
$sha256 = (Get-FileHash -Path src/python/rag.py -Algorithm SHA256).Hash
2222
echo "Current SHA256: $sha256"
2323
$previous_sha256 = "${{ github.event.before }}"
24-
if ($previous_sha256) {
24+
if ($previous_sha256 -and $previous_sha256 -ne "0000000000000000000000000000000000000000") {
2525
$previous_content = git show $previous_sha256:src/python/rag.py 2>$null
2626
if ($?) {
27-
echo $previous_content | Out-File temp_rag.py
27+
echo $previous_content | Out-File temp_rag.py -Encoding utf8
2828
$previous_hash = (Get-FileHash -Path temp_rag.py -Algorithm SHA256).Hash
2929
if ($previous_hash -eq $sha256) {
3030
echo "No changes detected in rag.py, skipping build and release."
31+
Remove-Item -Path temp_rag.py -Force -ErrorAction SilentlyContinue
3132
exit 0
3233
}
3334
}
3435
}
36+
Remove-Item -Path temp_rag.py -Force -ErrorAction SilentlyContinue
3537
echo "Building new rag.exe due to changes or no previous commit."
38+
shell: pwsh
3639

3740
# Set up Python
3841
- name: Set up Python
@@ -54,6 +57,7 @@ jobs:
5457
mkdir temp_dist
5558
pyinstaller --onefile --clean --distpath temp_dist src/python/rag.py
5659
if ($LASTEXITCODE -ne 0) { throw "PyInstaller build failed" }
60+
shell: pwsh
5761

5862
# Compress EXE with UPX
5963
- name: Compress EXE with UPX
@@ -88,7 +92,10 @@ jobs:
8892
# Clean up temporary directory
8993
- name: Clean up temporary directory
9094
if: always()
91-
run: Remove-Item -Path temp_dist -Recurse -Force -ErrorAction SilentlyContinue
95+
run: |
96+
Remove-Item -Path temp_dist -Recurse -Force -ErrorAction SilentlyContinue
97+
Remove-Item -Path temp_rag.py -Force -ErrorAction SilentlyContinue
98+
shell: pwsh
9299

93100
build-and-publish:
94101
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)