Skip to content

Commit 67176bf

Browse files
ci: add SHA256 checksum files to releases
1 parent 81fecc6 commit 67176bf

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,21 @@ jobs:
114114
Compress-Archive -Path dist\* -DestinationPath "$env:ZIP_NAME"
115115
Write-Host "Package created: $env:ZIP_NAME"
116116
117+
- name: Generate checksum (Linux/macOS)
118+
if: startsWith(github.ref, 'refs/tags/') && runner.os != 'Windows'
119+
shell: bash
120+
run: |
121+
sha256sum "${{ env.ZIP_NAME }}" > "${{ env.ZIP_NAME }}.sha256"
122+
cat "${{ env.ZIP_NAME }}.sha256"
123+
124+
- name: Generate checksum (Windows)
125+
if: startsWith(github.ref, 'refs/tags/') && runner.os == 'Windows'
126+
shell: pwsh
127+
run: |
128+
$hash = (Get-FileHash -Algorithm SHA256 "$env:ZIP_NAME").Hash.ToLower()
129+
"$hash $env:ZIP_NAME" | Out-File -Encoding ascii "$env:ZIP_NAME.sha256"
130+
Get-Content "$env:ZIP_NAME.sha256"
131+
117132
- name: Upload artifact
118133
if: startsWith(github.ref, 'refs/tags/')
119134
uses: actions/upload-artifact@v4
@@ -125,7 +140,9 @@ jobs:
125140
if: startsWith(github.ref, 'refs/tags/')
126141
uses: softprops/action-gh-release@v2
127142
with:
128-
files: ${{ env.ZIP_NAME }}
143+
files: |
144+
${{ env.ZIP_NAME }}
145+
${{ env.ZIP_NAME }}.sha256
129146
generate_release_notes: ${{ matrix.runner == 'ubuntu-22.04' }}
130147
fail_on_unmatched_files: false
131148
env:

0 commit comments

Comments
 (0)