Fix mobile-build using tag name instead of branch for filenames

When workflow_dispatch is triggered from a tag (e.g. v0.6.7) instead
of a branch, github.ref_name returns the tag name, causing filenames
like sure-v0.6.7-{stamp}.apk instead of sure-main-{stamp}.apk.

Guard against this by checking github.ref_type and falling back to the
repository's default branch when a tag is selected.

https://claude.ai/code/session_01TDfNkNxQ6uWxQxLAwJY5Qa
This commit is contained in:
Claude
2026-02-19 23:10:39 +00:00
committed by Juan José Mata
parent f339414257
commit efcc3583d5

View File

@@ -26,7 +26,13 @@ jobs:
# Sanitise branch name for use in file names and git tags
# e.g. feature/foo-bar → feature-foo-bar
RAW_BRANCH="${{ github.ref_name }}"
# When workflow_dispatch is triggered from a tag, fall back to the
# default branch so filenames use "main" instead of the tag name.
if [[ "${{ github.ref_type }}" == "tag" ]]; then
RAW_BRANCH="${{ github.event.repository.default_branch }}"
else
RAW_BRANCH="${{ github.ref_name }}"
fi
BRANCH="$(echo "$RAW_BRANCH" | sed 's/[^a-zA-Z0-9._-]/-/g' | sed 's/--*/-/g' | sed 's/^-//;s/-$//')"
VERSION="${BRANCH}-${STAMP}"