Build and Publish HeiniRemote Agent Flatpak / build (push) Failing after 9m25s
The tagless fallback truncated the sha to 12 chars for the version string and reused that as ref, so the upstream fetch failed with 'couldn't find remote ref'. Keep the full sha for ref, shorten only the version suffix. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
33 lines
1.3 KiB
Bash
Executable File
33 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Resolve which HeiniRemote revision to package. Prints eval-able output:
|
|
# version=<x.y.z or 0.0.0-git.<sha>>
|
|
# ref=<tag name or commit sha>
|
|
#
|
|
# Prefers the newest v* release tag on the upstream repo; while no release tag
|
|
# exists yet, falls back to the tip of main. The fallback version is derived
|
|
# ONLY from the commit sha, NOT the build date: the version must be a pure
|
|
# function of the source, so the nightly cron rebuilds when main actually
|
|
# moves — not every day just because the wall clock advanced (which would spawn
|
|
# a new tag/release/bundle daily).
|
|
# UPSTREAM_URL may carry credentials (CI injects the actions token for private
|
|
# repos); only derived values are printed.
|
|
set -euo pipefail
|
|
|
|
UPSTREAM_URL="${UPSTREAM_URL:-https://git.pc-heini.de/pc-heini/HeiniRemote.git}"
|
|
|
|
tag=$(git ls-remote --tags "$UPSTREAM_URL" 'refs/tags/v*' \
|
|
| awk -F'refs/tags/' '{print $2}' \
|
|
| grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' \
|
|
| sort -V | tail -n1 || true)
|
|
|
|
if [ -n "$tag" ]; then
|
|
echo "version=${tag#v}"
|
|
echo "ref=$tag"
|
|
else
|
|
# ref must stay the full sha: `git fetch <sha>` rejects abbreviated ids.
|
|
sha=$(git ls-remote "$UPSTREAM_URL" refs/heads/main | awk '{print $1}')
|
|
[ -n "$sha" ] || { echo "ERROR: cannot resolve upstream main" >&2; exit 1; }
|
|
echo "version=0.0.0-git.${sha:0:12}"
|
|
echo "ref=$sha"
|
|
fi
|