Automatic workflow to update yandex-music ebuild
Some checks failed
yandex-music / check-and-update (push) Failing after 29s
Some checks failed
yandex-music / check-and-update (push) Failing after 29s
This commit was merged in pull request #1.
This commit is contained in:
18
.gitea/actions/update-electron-bin-ebuild/action.yml
Normal file
18
.gitea/actions/update-electron-bin-ebuild/action.yml
Normal 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}}
|
||||
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