From bb6f0efa63629fc49d21a0ddd51f26d35c3defa0 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Thu, 22 Aug 2024 17:29:18 -0700 Subject: [PATCH] ci: add sha256 generation support to build.yml --- .github/workflows/build.yml | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b321c4a..29e5027 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -75,9 +75,35 @@ jobs: cp src/convert_lora_to_gguf.py $distPath/src/ cp src/convert_lora_to_ggml.py $distPath/src/ + - name: Generate SHA256 (Windows) + if: matrix.os == 'windows-latest' + run: | + $distPath = if ("${{ github.event.inputs.build_type }}" -eq "RELEASE") { "build\release\dist" } else { "build\dev\dist" } + $archSuffix = if ("${{ matrix.arch }}" -eq "x86") { "-x86" } else { "-x64" } + $exeName = "AutoGGUF$archSuffix.exe" + $versionHash = "${{ github.sha }}".Substring(0, 7) + $hashFile = "AutoGGUF-$versionHash.sha256" + Get-FileHash "$distPath\$exeName" -Algorithm SHA256 | Select-Object -ExpandProperty Hash | Out-File -FilePath "$distPath\$hashFile" + + - name: Generate SHA256 (Linux/macOS) + if: matrix.os != 'windows-latest' + run: | + distPath=$(if [ "${{ github.event.inputs.build_type }}" = "RELEASE" ]; then echo "build/release/dist"; else echo "build/dev/dist"; fi) + exeName="AutoGGUF-x64" + versionHash=$(echo ${{ github.sha }} | cut -c1-7) + hashFile="AutoGGUF-$versionHash.sha256" + sha256sum "$distPath/$exeName" | awk '{print $1}' > "$distPath/$hashFile" + - name: Upload Artifact uses: actions/upload-artifact@v2 with: name: AutoGGUF-${{ matrix.os }}-${{ matrix.arch }}-${{ github.event.inputs.build_type }}-${{ github.sha }} - path: build/${{ github.event.inputs.build_type == 'RELEASE' && 'release' || 'dev' }}/dist + path: | + build/${{ github.event.inputs.build_type == 'RELEASE' && 'release' || 'dev' }}/dist + !build/${{ github.event.inputs.build_type == 'RELEASE' && 'release' || 'dev' }}/dist/AutoGGUF-*.sha256 + - name: Upload SHA256 + uses: actions/upload-artifact@v2 + with: + name: AutoGGUF-${{ github.sha }}-SHA256 + path: build/${{ github.event.inputs.build_type == 'RELEASE' && 'release' || 'dev' }}/dist/AutoGGUF-*.sha256