Skip to content

Commit bb6f0ef

Browse files
committed
ci: add sha256 generation support to build.yml
1 parent a97a545 commit bb6f0ef

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

.github/workflows/build.yml

+27-1
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,35 @@ jobs:
7575
cp src/convert_lora_to_gguf.py $distPath/src/
7676
cp src/convert_lora_to_ggml.py $distPath/src/
7777
78+
- name: Generate SHA256 (Windows)
79+
if: matrix.os == 'windows-latest'
80+
run: |
81+
$distPath = if ("${{ github.event.inputs.build_type }}" -eq "RELEASE") { "build\release\dist" } else { "build\dev\dist" }
82+
$archSuffix = if ("${{ matrix.arch }}" -eq "x86") { "-x86" } else { "-x64" }
83+
$exeName = "AutoGGUF$archSuffix.exe"
84+
$versionHash = "${{ github.sha }}".Substring(0, 7)
85+
$hashFile = "AutoGGUF-$versionHash.sha256"
86+
Get-FileHash "$distPath\$exeName" -Algorithm SHA256 | Select-Object -ExpandProperty Hash | Out-File -FilePath "$distPath\$hashFile"
87+
88+
- name: Generate SHA256 (Linux/macOS)
89+
if: matrix.os != 'windows-latest'
90+
run: |
91+
distPath=$(if [ "${{ github.event.inputs.build_type }}" = "RELEASE" ]; then echo "build/release/dist"; else echo "build/dev/dist"; fi)
92+
exeName="AutoGGUF-x64"
93+
versionHash=$(echo ${{ github.sha }} | cut -c1-7)
94+
hashFile="AutoGGUF-$versionHash.sha256"
95+
sha256sum "$distPath/$exeName" | awk '{print $1}' > "$distPath/$hashFile"
96+
7897
- name: Upload Artifact
7998
uses: actions/upload-artifact@v2
8099
with:
81100
name: AutoGGUF-${{ matrix.os }}-${{ matrix.arch }}-${{ github.event.inputs.build_type }}-${{ github.sha }}
82-
path: build/${{ github.event.inputs.build_type == 'RELEASE' && 'release' || 'dev' }}/dist
101+
path: |
102+
build/${{ github.event.inputs.build_type == 'RELEASE' && 'release' || 'dev' }}/dist
103+
!build/${{ github.event.inputs.build_type == 'RELEASE' && 'release' || 'dev' }}/dist/AutoGGUF-*.sha256
83104
105+
- name: Upload SHA256
106+
uses: actions/upload-artifact@v2
107+
with:
108+
name: AutoGGUF-${{ github.sha }}-SHA256
109+
path: build/${{ github.event.inputs.build_type == 'RELEASE' && 'release' || 'dev' }}/dist/AutoGGUF-*.sha256

0 commit comments

Comments
 (0)