Take the tag name from the ref this forge sends, not the one it doesn't

5717abc · Gabriel Morell · 2026-09-16 19:38

3 files +18 -5
Message
{commit_body(@commit)}

Files changed

modified .forgejo/workflows/firmware.yml
+18 −5
@@ -82,11 +82,24 @@ jobs:
82 82 # A tag is a release and says so; everything else is stamped with the
83 83 # date and commit it came from, which is what a device reports back
84 84 # over /status and what a person needs to find the build again.
85 − if [ "${GITHUB_REF_TYPE:-branch}" = "tag" ]; then
86 − version=${GITHUB_REF_NAME#v}
87 − else
88 − version="${base}+ci$(date -u +%Y%m%d).g${GITHUB_SHA:0:7}"
89 − fi
85 + #
86 + # Matched on GITHUB_REF rather than GITHUB_REF_TYPE/GITHUB_REF_NAME,
87 + # neither of which this forge sets — its runner context carries
88 + # `ref`, `sha` and `repository` and nothing else of this kind. The
89 + # tag branch had never run, and would have published an *empty*
90 + # version string the first time somebody tagged a release. Which
91 + # devices would then install, since empty differs from what they run.
92 + case "${GITHUB_REF:-}" in
93 + refs/tags/*)
94 + version=${GITHUB_REF#refs/tags/}
95 + version=${version#v}
96 + ;;
97 + *)
98 + version="${base}+ci$(date -u +%Y%m%d).g${GITHUB_SHA:0:7}"
99 + ;;
100 + esac
101 +
102 + : "${version:?the version came out empty}"
90 103
91 104 echo "version: $version"
92 105 echo "VERSION=$version" >> "$GITHUB_ENV"

Parents: d76b734