From 59c06b3a19f03f7454166d9679e1cdc0f64ecd69 Mon Sep 17 00:00:00 2001 From: KenanZhu <3471685733@qq.com> Date: Thu, 28 May 2026 02:49:46 +0800 Subject: [PATCH] =?UTF-8?q?fix(workflows):=20=E4=BF=AE=E5=A4=8D=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E5=BC=95=E7=94=A8=E3=80=81=E6=9D=A1=E4=BB=B6=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E6=AD=BB=E4=BB=A3=E7=A0=81=E5=B9=B6=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 --- .github/workflows/build-test.yml | 24 ++++++++++++------------ .github/workflows/build.yml | 23 ++++++++++++++--------- .github/workflows/commit-release.yml | 10 +++++++++- .github/workflows/release.yml | 21 ++++++++++++++------- .github/workflows/update-version.yml | 16 +++++++++++++--- 5 files changed, 62 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 31da669..dc6c2de 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -4,10 +4,6 @@ name: Build Test # It is triggered when a pull request is opened, synchronized, or reopened against the main branch. on: - push: - branches: - - main - pull_request: branches: - main @@ -15,7 +11,6 @@ on: - opened - synchronize - reopened - # Allow manual trigger for testing workflow_dispatch: # @@ -49,6 +44,8 @@ jobs: uses: actions/setup-python@v6 with: python-version: '3.13' + cache: 'pip' + cache-dependency-path: requirement.txt - name: Install dependencies run: | @@ -125,7 +122,7 @@ jobs: " binaries=[]," " datas=[" " ('models\\common.onnx', 'ddddocr')," - " ('src\\gui\\resources\\icons\\AutoLibrary_32x32.ico', 'gui\\resources\\icons')," + " ('src\\gui\\resources\\icons\\AutoLibrary_Logo_64.ico', 'gui\\resources\\icons')," " ]," " hiddenimports=[]," " hookspath=[]," @@ -153,7 +150,7 @@ jobs: " target_arch=None," " codesign_identity=None," " entitlements_file=None," - " icon=['src\\gui\\resources\\icons\\AutoLibrary_32x32.ico']," + " icon=['src\\gui\\resources\\icons\\AutoLibrary_Logo_64.ico']," ")" "" "coll = COLLECT(" @@ -169,9 +166,11 @@ jobs: $specLines | Out-File -FilePath "Main.spec" -Encoding UTF8 Write-Host "✓ Main.spec (non-single file) generated successfully" - Write-Host "`nGenerated Main.spec ============" + Write-Host "`n========================================" + Write-Host "Generated Main.spec" + Write-Host "========================================" Get-Content "Main.spec" | Write-Host - Write-Host "==================================`n" + Write-Host "========================================`n" shell: pwsh - name: Build with PyInstaller @@ -186,7 +185,7 @@ jobs: $distDir = "dist/AutoLibrary-$version" $zipName = "AutoLibrary.$tagName-windows-x86_64.zip" - echo "ZIP_NAME=$zipName" >> $env:GITHUB_OUTPUT + "ZIP_NAME=$zipName" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append Write-Host "Looking for distribution directory: $distDir" if (Test-Path $distDir) { @@ -212,10 +211,11 @@ jobs: run: | Write-Host "## Build Test Summary" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 Write-Host "" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append + Write-Host "========================================" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append Write-Host "✓ Pull request build test completed successfully!" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append Write-Host "- Version: ${{ steps.get_version.outputs.VERSION }}" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append Write-Host "- Tag: ${{ steps.get_version.outputs.TAG_NAME }}" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append - Write-Host "- Pull Request #${{ github.event.pull_request.number }}" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append - Write-Host "- Branch: ${{ github.event.pull_request.head.ref }}" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append + Write-Host "- Pull Request #${{ github.event.pull_request.number || 'N/A' }}" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append + Write-Host "- Branch: ${{ github.event.pull_request.head.ref || github.ref }}" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append Write-Host "- Event: ${{ github.event_name }}" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append shell: pwsh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cea2c05..71e572d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -76,15 +76,17 @@ jobs: run: | $versionInfoFile = "src/gui/ALVersionInfo.py" Write-Host "Verifying $versionInfoFile content:" - Write-Host "==================================" + Write-Host "========================================" Get-Content $versionInfoFile | Write-Host - Write-Host "==================================" + Write-Host "========================================" shell: pwsh - name: Set up Python uses: actions/setup-python@v6 with: python-version: '3.13' + cache: 'pip' + cache-dependency-path: requirement.txt - name: Install dependencies run: | @@ -161,7 +163,7 @@ jobs: " binaries=[]," " datas=[" " ('models\\common.onnx', 'ddddocr')," - " ('src\\gui\\resources\\icons\\AutoLibrary_32x32.ico', 'gui\\resources\\icons')," + " ('src\\gui\\resources\\icons\\AutoLibrary_Logo_64.ico', 'gui\\resources\\icons')," " ]," " hiddenimports=[]," " hookspath=[]," @@ -189,7 +191,7 @@ jobs: " target_arch=None," " codesign_identity=None," " entitlements_file=None," - " icon=['src\\gui\\resources\\icons\\AutoLibrary_32x32.ico']," + " icon=['src\\gui\\resources\\icons\\AutoLibrary_Logo_64.ico']," ")" "" "coll = COLLECT(" @@ -205,9 +207,11 @@ jobs: $specLines | Out-File -FilePath "Main.spec" -Encoding UTF8 Write-Host "✓ Main.spec (non-single file) generated successfully" - Write-Host "`nGenerated Main.spec ============" + Write-Host "`n========================================" + Write-Host "Generated Main.spec" + Write-Host "========================================" Get-Content "Main.spec" | Write-Host - Write-Host "==================================`n" + Write-Host "========================================`n" shell: pwsh - name: Build with PyInstaller @@ -222,7 +226,7 @@ jobs: $distDir = "dist/AutoLibrary-$version" $zipName = "AutoLibrary.$tagName-windows-x86_64.zip" - echo "ZIP_NAME=$zipName" >> $env:GITHUB_OUTPUT + "ZIP_NAME=$zipName" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append Write-Host "Looking for distribution directory: $distDir" if (Test-Path $distDir) { @@ -242,13 +246,14 @@ jobs: name: AutoLibrary.${{ steps.get_version.outputs.TAG_NAME }}-windows-x86_64 path: | ${{ steps.zip_release.outputs.ZIP_NAME }} - retention-days: ${{ github.event_name != 'workflow_call' && 7 || 90 }} + retention-days: ${{ inputs.is_test == 'true' && 7 || 90 }} - name: Upload build summary - if: ${{ github.event_name != 'workflow_call' }} + if: ${{ inputs.is_test == 'true' }} run: | Write-Host "## Build Summary" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 Write-Host "" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append + Write-Host "========================================" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append Write-Host "✓ Build test completed successfully!" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append Write-Host "- Version: ${{ steps.get_version.outputs.VERSION }}" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append Write-Host "- Tag: ${{ steps.get_version.outputs.TAG_NAME }}" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append diff --git a/.github/workflows/commit-release.yml b/.github/workflows/commit-release.yml index 00335d3..76d174a 100644 --- a/.github/workflows/commit-release.yml +++ b/.github/workflows/commit-release.yml @@ -83,7 +83,9 @@ jobs: echo "✓ File replaced: $FILE_PATH" echo "" - echo "Updated file content ===================" + echo "========================================" + echo "Updated file content" + echo "========================================" cat "$FILE_PATH" echo "========================================" @@ -151,3 +153,9 @@ jobs: COMMIT_SHA=$(git rev-parse --short HEAD) echo "commit_sha=$COMMIT_SHA" >> $GITHUB_OUTPUT echo "✓ New commit SHA: $COMMIT_SHA" + echo "## Commit Release Summary" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "========================================" >> $GITHUB_STEP_SUMMARY + echo "- Version: ${{ inputs.version }}" >> $GITHUB_STEP_SUMMARY + echo "- Tag: ${{ inputs.tag_name }}" >> $GITHUB_STEP_SUMMARY + echo "- Commit SHA: $COMMIT_SHA" >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4e87fab..4a49f86 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,7 +47,7 @@ on: jobs: # # Start : - # virtual job that indacates the start of the release process + # virtual job that indicates the start of the release process # start: @@ -158,7 +158,7 @@ jobs: needs: - update-version - commit-release - if: always() && needs.update-version.result == 'success' && needs.commit-release.result == 'success' + if: always() && needs.update-version.result == 'success' && (needs.commit-release.result == 'success' || needs.commit-release.result == 'skipped') uses: ./.github/workflows/build.yml permissions: contents: write @@ -205,7 +205,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # End : - # virtual job that indacates the end of the release process + # virtual job that indicates the end of the release process # end: @@ -227,7 +227,7 @@ jobs: - release - extract-version - commit-release - if: ${{ needs.release.result == 'success' && needs.commit-release.result == 'success' }} + if: ${{ needs.release.result == 'success' && (needs.commit-release.result == 'success' || needs.commit-release.result == 'skipped') }} runs-on: ubuntu-latest permissions: contents: write @@ -267,9 +267,13 @@ jobs: git checkout ${MAIN_BRANCH} # Show branch status before merge - echo "=== Branch status before merge ===" + echo "========================================" + echo "Branch status before merge" + echo "========================================" git log --oneline --graph --all -5 - echo "=== Diff between ${MAIN_BRANCH} and origin/${BRANCH_NAME} ===" + echo "========================================" + echo "Diff: ${MAIN_BRANCH} vs origin/${BRANCH_NAME}" + echo "========================================" git diff ${MAIN_BRANCH} origin/${BRANCH_NAME} --stat || echo "No differences found" # Force create a merge commit even if there are no changes @@ -279,7 +283,9 @@ jobs: -m "chore(release): merge ${BRANCH_NAME} to ${MAIN_BRANCH} [auto release commit]" # Show merge result - echo "=== Merge result ===" + echo "========================================" + echo "Merge result" + echo "========================================" git log --oneline --graph -3 # Push to main @@ -310,6 +316,7 @@ jobs: echo "## Release Cleanup Summary" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY + echo "========================================" >> $GITHUB_STEP_SUMMARY echo "✓ Release completed successfully!" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "### Actions Performed:" >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml index 112329f..512f6f3 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version.yml @@ -128,10 +128,15 @@ jobs: echo "Build version file location: $VER_INFO_BUILDFILE" echo "Commit version file location: $VER_INFO_COMMITFILE" echo "" - echo "Build version ALVersionInfo.py content =" + echo "========================================" + echo "Build version ALVersionInfo.py" + echo "========================================" cat "$VER_INFO_BUILDFILE" + echo "========================================" echo "" - echo "Commit version ALVersionInfo.py content " + echo "========================================" + echo "Commit version ALVersionInfo.py" + echo "========================================" cat "$VER_INFO_COMMITFILE" echo "========================================" @@ -140,11 +145,16 @@ jobs: run: | if git diff --quiet src/gui/ALVersionInfo.py; then echo "has_changes=false" >> $GITHUB_OUTPUT - echo "! No changes detected in ALVersionInfo.py" + echo "⚠ No changes detected in ALVersionInfo.py" else echo "has_changes=true" >> $GITHUB_OUTPUT echo "✓ ALVersionInfo.py has been modified" fi + echo "## Update Version Summary" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "========================================" >> $GITHUB_STEP_SUMMARY + echo "- Version: ${{ steps.get_version.outputs.VERSION }}" >> $GITHUB_STEP_SUMMARY + echo "- Tag: ${{ steps.get_version.outputs.TAG_NAME }}" >> $GITHUB_STEP_SUMMARY - name: Upload modified ALVersionInfo.py ready for build if: steps.check_changes.outputs.has_changes == 'true'