homebrew-gitea/bump_version.sh
Bo-Yi Wu 4bf7c6c832 feat: improve returned recordings and expand OS compatibility (#164)
- Add new formula `act_runner-head.rb` for Gitea runner based on act with `main` version
- Add new formula `act_runner.rb` for Gitea runner based on act with version `0.1.4`
- Update `bump_version.sh` to include `act_runner` in the binaries list

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

fix gitea/homebrew-gitea#163

Co-authored-by: techknowlogick <techknowlogick@noreply.gitea.io>
Reviewed-on: gitea/homebrew-gitea#164
Reviewed-by: silverwind <silverwind@noreply.gitea.io>
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.io>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-committed-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2023-05-03 09:54:40 +08:00

37 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
binaries="tea act_runner gitea"
for bin in ${binaries};do
file="${bin}.rb"
case "$bin" in
tea)
git_url="https://gitea.com/gitea/tea"
supported_os="linux-386 linux-amd64 linux-arm64 darwin-amd64 darwin-arm64";;
act_runner)
git_url="https://gitea.com/gitea/act_runner"
supported_os="linux-amd64 linux-arm64 darwin-amd64 darwin-arm64";;
gitea)
git_url="https://github.com/go-gitea/gitea"
supported_os="linux-386 linux-amd64 linux-arm64 darwin-10.12-amd64 darwin-10.12-arm64";;
*)
>&2 echo "Error: unrecognized binary ($bin)"
exit 1;;
esac
latest=$(curl -sL -o /dev/null -w %{url_effective} "${git_url}/releases/latest")
version="${latest##*/v}"
echo "update ${bin} version: ${version}"
file_url="https://dl.gitea.com/${bin}/${version}"
for os in ${supported_os}; do
sha256_file="${bin}-${version}-${os}"
if [ "$os" != "linux-386" -a "$os" != "linux-arm64" ]; then
sha256_file="${sha256_file}.xz"
fi
sha256_file="${sha256_file}.sha256"
sha256=$(curl -sL "${file_url}/${sha256_file}" | awk '{print$1}')
echo "update ${bin} os: ${os}, sha256: ${sha256}"
sed -r "s/^(\s+when \"${os}\" then).*\"(.*)$/\1 \"${sha256}\"\2/" -i "${file}"
done
sed -r "s/^(\s+version).*/\1 \"${version}\"/" -i "${file}"
done