Update workflow
This commit is contained in:
40
.gitea/actions/update-electron-bin-ebuild/entrypoint.sh
Executable file
40
.gitea/actions/update-electron-bin-ebuild/entrypoint.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/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}"
|
||||
Reference in New Issue
Block a user