[feat] support standalone iOS and Android releases

This commit is contained in:
dijunkun
2026-10-02 02:38:45 +08:00
parent 3b5cbf0735
commit 49e90adb60
9 changed files with 236 additions and 9 deletions
+17 -1
View File
@@ -3,6 +3,12 @@ name: Build Android
on:
workflow_dispatch:
workflow_call:
inputs:
source_tag:
description: "Existing source tag for a standalone Android release."
required: false
type: string
default: ""
outputs:
version:
description: "Independent Android version and build date."
@@ -11,6 +17,7 @@ on:
paths:
- ".github/workflows/build-android.yml"
- ".github/workflows/build.yml"
- ".github/workflows/release-mobile.yml"
- ".gitmodules"
- "LICENSE"
- "apps/android/**"
@@ -32,11 +39,14 @@ jobs:
version: ${{ steps.package.outputs.version }}
env:
XMAKE_VERSION: "3.1.1"
CROSSDESK_SOURCE_TAG: ${{ inputs.source_tag || '' }}
CROSSDESK_RELEASE_BUILD: ${{ inputs.source_tag && 'YES' || 'NO' }}
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0
ref: ${{ inputs.source_tag || github.ref }}
submodules: recursive
persist-credentials: false
@@ -120,13 +130,19 @@ jobs:
raise ValueError(f"Invalid Android version: {version!r}")
build_date = datetime.datetime.now(ZoneInfo("Asia/Shanghai")).strftime("%Y%m%d")
# Match the dated release tags used by the desktop and iOS jobs.
if os.environ["GITHUB_REF_TYPE"] == "tag":
tag = os.environ.get("CROSSDESK_SOURCE_TAG")
if not tag and os.environ["GITHUB_REF_TYPE"] == "tag":
tag = os.environ["GITHUB_REF_NAME"]
if tag:
tag = tag.removeprefix("android-")
match = re.fullmatch(r"v?[0-9]+(?:\.[0-9]+){1,3}-(?:[0-9]+-)?([0-9]{8})(?:-[0-9]+)?", tag)
if match:
build_date = match[1]
datetime.datetime.strptime(build_date, "%Y%m%d")
version = f"v{version}-{build_date}"
source_tag = os.environ.get("CROSSDESK_SOURCE_TAG", "")
if source_tag.startswith("android-v") and source_tag.removeprefix("android-") != version:
raise ValueError(f"Android source tag does not match the app version: {source_tag} vs {version}")
output = Path(os.environ["RUNNER_TEMP"]) / "crossdesk-android"
for variant, source in (
("unsigned", "release/app-release-unsigned.apk"),