Files
ratigorsk-auto/.gitea/actions/copy-latest-ebuild-as/action.yml
2026-02-06 00:41:42 +03:00

35 lines
1.2 KiB
YAML

name: "Copy the latest ebuild for the package as version given"
description: "Checks if the ebuild with the specified version exists and if not - copies the latest existing one over"
inputs:
atom:
description: "category/name package atom"
required: true
version:
description: "the desired version of the ebuild"
required: true
outputs:
message:
description: "space separated list of versions added"
value: ${{ steps.copy.outputs.message }}
runs:
using: composite
steps:
- id: copy
shell: bash
run: |
set -euo pipefail
ebuild_dir="./${{ inputs.atom }}"
name=$(basename "${{ inputs.atom }}")
want_ebuild="${ebuild_dir}/${name}-${{ inputs.version }}.ebuild"
message=""
if [[ -f "${want_ebuild}" ]]; then
echo "Ebuild already exists"
else
existing_ebuilds=( "${ebuild_dir}"/*.ebuild )
latest_existing_ebuild="${existing_ebuilds[-1]}"
echo "Copying ${latest_existing_ebuild} to ${want_ebuild}"
cp "${latest_existing_ebuild}" "${want_ebuild}"
message="added ${{ inputs.version }}"
fi
echo "message=${message}" >> "${GITHUB_OUTPUT}"