config-update

This commit is contained in:
j-hc 2024-05-21 15:07:00 +03:00
parent d05014fb7e
commit e0de71bb57
No known key found for this signature in database
GPG Key ID: CDF97F1DBFE904CD

View File

@ -40,7 +40,9 @@ abort() {
get_rv_prebuilts() {
local cli_src=$1 cli_ver=$2 integrations_src=$3 integrations_ver=$4 patches_src=$5 patches_ver=$6
pr "Getting prebuilts (${patches_src%/*})" >&2
for f in "${TEMP_DIR}"/*-rv; do : >"${f}/changelog.md"; done
local cl_dir=${patches_src%/*}
cl_dir=${TEMP_DIR}/${cl_dir,,}-rv
[ -d "$cl_dir" ] || mkdir "$cl_dir"
for src_ver in "$cli_src CLI $cli_ver" "$integrations_src Integrations $integrations_ver" "$patches_src Patches $patches_ver"; do
set -- $src_ver
local src=$1 tag=$2 ver=${3-} ext
@ -64,7 +66,7 @@ get_rv_prebuilts() {
file="${dir}/${name}"
[ -f "$file" ] || REBUILD=true
echo "$tag: $(cut -d/ -f5 <<<"$url")/${name} " >>"$dir/changelog.md"
echo "$tag: $(cut -d/ -f5 <<<"$url")/${name} " >>"${cl_dir}/changelog.md"
gh_dl "$file" "$url" >&2 || return 1
echo -n "$file "
if [ "$tag" = "Patches" ]; then
@ -75,7 +77,7 @@ get_rv_prebuilts() {
url=$(jq -e -r '.assets[] | select(.name | endswith("json")) | .url' <<<"$resp") || return 1
gh_dl "$file" "$url" >&2 || return 1
echo -n "$file "
echo -e "[Changelog](https://github.com/${src}/releases/tag/${tag_name})\n" >>"$dir/changelog.md"
echo -e "[Changelog](https://github.com/${src}/releases/tag/${tag_name})\n" >>"${cl_dir}/changelog.md"
fi
done
echo
@ -99,6 +101,7 @@ get_prebuilts() {
}
config_update() {
if [ ! -f build.md ]; then abort "build.md not available"; fi
declare -A sources
: >$TEMP_DIR/skipped
local conf=""
@ -119,11 +122,10 @@ config_update() {
fi
else
sources[$PATCHES_SRC]=0
if ! last_patches_url=$(gh_req "https://api.github.com/repos/${PATCHES_SRC}/releases/latest" - \
if ! last_patches=$(gh_req "https://api.github.com/repos/${PATCHES_SRC}/releases/latest" - \
| jq -e -r '.assets[] | select(.name | endswith("jar")) | .name'); then
abort oops
fi
last_patches=${last_patches_url##*/}
cur_patches=$(sed -n "s/.*Patches: ${PATCHES_SRC%%/*}\/\(.*\)/\1/p" build.md | xargs)
if [ "$cur_patches" ] && [ "$last_patches" ]; then
if [ "${cur_patches}" != "$last_patches" ]; then