ci: 移除 dumpbin 检测避免误报失败 #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build (winx64) | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| workflow_dispatch: | |
| jobs: | |
| build-winx64: | |
| name: build-winx64 | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Secret scan (fail if real ARK key committed) | |
| shell: pwsh | |
| run: | | |
| $patterns = @("sk-","ARK_API_KEY\s*=\s*[^=\s]{20,}") | |
| $hits = Select-String -Path "config/config.ini","src/*.cs","README*.md" -Pattern ($patterns -join "|") -ErrorAction SilentlyContinue | Where-Object { $_.Line -notmatch "ARK_API_KEY.*env|GameProblemMonitorAiApiKey.*empty|ARK_API_KEY.*注入" } | |
| # Allowlist: template mentions env var name only, not value. Fail if GameProblemMonitorAiApiKey has non-empty value in config template. | |
| $cfg = Get-Content "config/config.ini" -ErrorAction SilentlyContinue | Select-String -Pattern "^GameProblemMonitorAiApiKey\s*=\s*.+" | Where-Object { $_.Line.Trim() -ne "GameProblemMonitorAiApiKey=" } | |
| if ($cfg) { Write-Error "config/config.ini must keep GameProblemMonitorAiApiKey empty (use env ARK_API_KEY)"; exit 1 } | |
| if ($hits) { $hits | ForEach-Object { Write-Host $_ }; Write-Error "Potential secret found in repo"; exit 1 } | |
| Write-Host "Secret scan passed" | |
| - name: Diagnose SDK | |
| shell: pwsh | |
| run: | | |
| Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\UnionMetadata" -Directory -ErrorAction SilentlyContinue | Format-Table Name | |
| Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\UnionMetadata\*\Windows.winmd" -ErrorAction SilentlyContinue | Select-Object FullName | Format-List | |
| Get-ChildItem "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework" -Directory -ErrorAction SilentlyContinue | Format-Table Name | |
| - name: Build winx64 with csc.exe (no SDK required) | |
| shell: cmd | |
| run: | | |
| call scripts\build.cmd | |
| if errorlevel 1 ( | |
| echo [workflow] build.cmd failed, trying fallback diagnostic | |
| dir "C:\Program Files (x86)\Windows Kits\10\UnionMetadata" /s /b 2>nul | findstr Windows.winmd | |
| exit /b 1 | |
| ) | |
| dir build | |
| if not exist build\BluetoothAutoLock.exe ( | |
| echo BluetoothAutoLock.exe not found | |
| exit /b 1 | |
| ) | |
| echo [workflow] winx64 build OK - platform x64 | |
| - name: Upload winx64 artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: BluetoothAutoLock-winx64-${{ github.sha }} | |
| path: | | |
| build/BluetoothAutoLock.exe | |
| build/config.ini | |
| if-no-files-found: error | |
| retention-days: 14 | |
| - name: Release (on tag) | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| build/BluetoothAutoLock.exe | |
| build/config.ini |