Files
ratigorsk-auto/.gitea/actions/determine-package-state/action.yml
T
petr.polezhaev 15dcbe3c44
yandex-music / check-and-update (push) Successful in 2m19s
github-release / check-and-update (push) Successful in 28s
esphome-desktop-bin / update (push) Successful in 28s
github-release / check-and-update (push) Successful in 30s
opencode-desktop-bin / update (push) Successful in 31s
new ebuild: dev-embedded/esphome-desktop-bin
2026-11-26 01:32:06 +03:00

71 lines
2.2 KiB
YAML

name: "Determine package state"
description: "Check whether the requested release needs a new ebuild or a manifest update"
inputs:
atom:
description: "category/name package atom"
required: true
version:
description: "release version without the v prefix"
required: true
forced:
description: "true when the version was supplied manually"
required: false
default: "false"
arch:
description: "architecture suffix used in the distfile name"
required: false
default: "amd64"
outputs:
eligible:
description: "false when the requested release is older than the newest ebuild"
value: ${{ steps.state.outputs.eligible }}
up_to_date:
description: "true when the ebuild and its Manifest entry already exist"
value: ${{ steps.state.outputs.up_to_date }}
runs:
using: composite
steps:
- id: state
shell: bash
env:
ATOM: ${{ inputs.atom }}
VERSION: ${{ inputs.version }}
FORCED: ${{ inputs.forced }}
ARCH: ${{ inputs.arch }}
run: |
set -euo pipefail
name="${ATOM##*/}"
ebuild="${ATOM}/${name}-${VERSION}.ebuild"
dist="${name}-${VERSION}-${ARCH}.deb"
shopt -s nullglob
existing=( "${ATOM}/${name}-"*.ebuild )
highest_existing=""
if (( ${#existing[@]} > 0 )); then
highest_existing=$(
printf '%s\n' "${existing[@]}" \
| sed -e "s|^.*/${name}-||" -e 's|\.ebuild$||' \
| sort -V \
| tail -n 1
)
fi
eligible=true
if [[ "${FORCED}" != "true" && -n "${highest_existing}" ]]; then
highest=$(printf '%s\n%s\n' "${highest_existing}" "${VERSION}" | sort -V | tail -n 1)
if [[ "${highest}" != "${VERSION}" ]]; then
echo "Selected release ${VERSION} is older than ${highest_existing}; skipping" >&2
eligible=false
fi
fi
if [[ -f "${ebuild}" ]] \
&& grep -q "^DIST ${dist} " "${ATOM}/Manifest" 2>/dev/null; then
up_to_date=true
else
up_to_date=false
fi
echo "eligible=${eligible}" >> "${GITHUB_OUTPUT}"
echo "up_to_date=${up_to_date}" >> "${GITHUB_OUTPUT}"