Update workflow

This commit is contained in:
2026-02-06 00:41:42 +03:00
parent 8a7f3eaf16
commit 55c97eb708
9 changed files with 239 additions and 11 deletions

View File

@@ -0,0 +1,18 @@
name: "Update electron app bin ebuild if needed"
description: "Check the update manifest and copy an existing version ebuild if a new version is out"
inputs:
atom:
description: "category/name specifying the ebuild to update"
required: true
update-url:
description: "electron-updater update manifest url to check"
required: true
outputs:
changes:
description: "if any changes were produced"
runs:
using: "docker"
image: "Dockerfile"
args:
- ${{inputs.atom}}
- ${{inputs.update-url}}

View 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}"