Files
donutbrowser/.github/scripts/release-checksums.sh
T
2026-11-19 02:36:20 +04:00

26 lines
851 B
Bash
Executable File

#!/usr/bin/env bash
# Writes SHA256SUMS.txt for every Donut* asset of release TAG and uploads it,
# replacing an older one. The app updater refuses a release it cannot verify
# against this file, so release.yml runs it as soon as the builds are up, and
# again once the Flatpak and the Snap are attached.
#
# bash .github/scripts/release-checksums.sh TAG [COPY_TO]
#
# COPY_TO gets a copy of the file, for the attestation step.
#
# Needs GH_TOKEN and GITHUB_REPOSITORY.
set -euo pipefail
tag=$1
assets_dir=$(mktemp -d)
trap 'rm -rf "$assets_dir"' EXIT
gh release download "$tag" --repo "$GITHUB_REPOSITORY" --dir "$assets_dir" --pattern 'Donut*'
cd "$assets_dir"
sha256sum Donut* > SHA256SUMS.txt
cat SHA256SUMS.txt
gh release upload "$tag" SHA256SUMS.txt --clobber --repo "$GITHUB_REPOSITORY"
if [ -n "${2:-}" ]; then
cp SHA256SUMS.txt "$2"
fi