mirror of
https://github.com/we-promise/sure.git
synced 2026-04-11 08:14:49 +00:00
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:
8
.github/workflows/mobile-build.yml
vendored
8
.github/workflows/mobile-build.yml
vendored
@@ -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}"
|
||||
|
||||
Reference in New Issue
Block a user