Files
ratigorsk-auto/.gitea/actions/update-electron-bin-ebuild/entrypoint.sh
Petr Polezhaev 32173db78b
Some checks failed
yandex-music / check-and-update (push) Failing after 29s
Automatic workflow to update yandex-music ebuild
2026-02-06 00:58:08 +03:00

41 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
atom="${1}"
update_url="${2}"
echo "Fetching update manifest from ${update_url}"
update_manifest=$(mktemp)
curl --follow -s -o "${update_manifest}" "${update_url}"
latest_version=$(yq -r '.version' "${update_manifest}")
echo "Latest version: ${latest_version}"
if [[ -z "${latest_version}" ]]; then
echo "No version tag in the downloaded manifest" >&2
cat "${update_manifest}" >&2
exit 1
fi
ebuild_dir="${GITHUB_WORKSPACE}/$atom"
latest_ebuild="${ebuild_dir}/yandex-music-${latest_version}.ebuild"
if [[ -f "${latest_ebuild}" ]]; then
echo "Ebuild for version ${latest_version} already exists"
exit 0
fi
echo "New version detected: ${latest_version}"
existing_ebuilds=( "${ebuild_dir}"/*.ebuild )
latest_existing_ebuild="${existing_ebuilds[-1]}"
if [[ -z "${latest_existing_ebuild}" ]]; then
echo "Error: No existing ebuild found to copy from" >&2
exit 1
fi
echo "Copying ${latest_existing_ebuild} to ${latest_ebuild}"
cp "${latest_existing_ebuild}" "${latest_ebuild}"