#!/bin/sh -e # SPDX-FileCopyrightText: Copyright 2026 crueter # SPDX-License-Identifier: LGPL-3.0-or-later filter_out() { TAGS=$(echo "$TAGS" | jq "[.[] | select(.name | test(\"$1\"; \"i\") | not)]") } filter_in() { TAGS=$(echo "$TAGS" | jq "[.[] | select(.name | test(\"$1\"; \"i\"))]") } usage() { cat </dev/null 2>&1; then TAGS=$(gh api --method GET "$endpoint") else TAGS=$(curl -sfL "https://api.github.com$endpoint") fi # filter out some commonly known annoyances # TODO add more if [ "$PACKAGE" = "vulkan-validation-layers" ]; then filter_in vulkan-sdk else filter_out vulkan-sdk fi filter_out yotta # mbedtls # ???????????????????????????????? filter_out vksc # ignore betas/alphas (remove if needed) filter_out alpha filter_out beta filter_out rc # Add package-specific overrides here, e.g. here for fmt: [ "$PACKAGE" != fmt ] || filter_out v0.11 LATEST=$(echo "$TAGS" | jq -r '.[0].name') if [ "$LATEST" = "null" ] || { [ "$LATEST" = "$TAG" ] && [ "$FORCE" != "true" ]; }; then echo "-- * Up-to-date" continue fi if [ "$HAS_REPLACE" = "true" ]; then # this just extracts the tag prefix VERSION_PREFIX=$(echo "$ORIGINAL_TAG" | cut -d"%" -f1) # then we strip out the prefix from the new tag, and make that our new git_version if [ -z "$VERSION_PREFIX" ]; then NEW_GIT_VERSION="$LATEST" else NEW_GIT_VERSION=$(echo "$LATEST" | sed "s/$VERSION_PREFIX//g") fi else NEW_GIT_VERSION="$LATEST" fi _commit="$_commit * $PACKAGE: $GIT_VERSION -> $NEW_GIT_VERSION" echo "-- * Version $LATEST available, current is $TAG" if [ "$UPDATE" = "true" ]; then if [ "$HAS_REPLACE" = "true" ]; then NEW_JSON=$(echo "$JSON" | jq ".git_version = \"$NEW_GIT_VERSION\"") else NEW_JSON=$(echo "$JSON" | jq ".tag = \"$NEW_GIT_VERSION\"") fi "$SCRIPTS"/util/replace.sh "$PACKAGE" "$NEW_JSON" echo "-- * -- Updating hash" export UPDATE QUIET=true "$SCRIPTS"/util/fix-hash.sh "$PACKAGE" fi done if [ "$UPDATE" = "true" ] && [ "$COMMIT" = "true" ] && [ -n "$_commit" ]; then for file in $CPMFILES; do git add "$file" done git commit -m "Update dependencies $_commit" fi