Files
homebrew-tap/.github/scripts/bump-zshellcheck.sh
T
tri 07026e2c7a ci: run the bump workflow on Gitea Actions
The tap moved to git.trivk.dev. Gitea Runner has no parallel steps, so
the two bumps run one after the other. The scripts ask api.github.com
with curl instead of gh, which needs a GitHub token the Gitea job does
not have; two unauthenticated requests per run stay far under the limit.
The README now taps with the git.trivk.dev URL.
2026-11-10 15:53:28 +07:00

35 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Updates Formula/zshellcheck.rb to the latest zshellcheck release.
# On a new version it writes "$BUMP_DIR/zshellcheck": the commit message, then the changed files.
set -euo pipefail
formula=Formula/zshellcheck.rb
repo=afadesigns/zshellcheck
latest=$(curl -fsSL "https://api.github.com/repos/$repo/releases/latest" | jq -r .tag_name)
latest=${latest#v}
current=$(sed -nE 's|.*/releases/download/v([^/]+)/.*|\1|p' "$formula" | head -1)
if [ "$latest" = "$current" ]; then
echo "Already at $current"
exit 0
fi
# The release publishes checksums.txt with a sha256 for every asset.
if ! checksums=$(curl -fsSL "https://github.com/$repo/releases/download/v$latest/checksums.txt"); then
echo "checksums.txt is not published yet"
exit 0
fi
declare -A sha
for asset in zshellcheck_Darwin_{arm64,x86_64}.tar.gz; do
sha[$asset]=$(awk -v a="$asset" '$2 == a { print $1 }' <<<"$checksums")
if [ -z "${sha[$asset]}" ]; then
echo "$asset is not published yet"
exit 0
fi
done
sed -i -E "s|/v${current//./\\.}/|/v$latest/|g" "$formula"
for asset in "${!sha[@]}"; do
sed -i -E "/\/${asset//./\\.}\"/{n;s/[0-9a-f]{64}/${sha[$asset]}/}" "$formula"
done
echo "chore: bump zshellcheck to $latest" > "$BUMP_DIR/zshellcheck"
echo "$formula" >> "$BUMP_DIR/zshellcheck"