Refactor mobile release asset flow

This commit is contained in:
Juan José Mata
2026-02-13 12:00:08 +01:00
parent fceebd53a7
commit 7df2bd7d3b
3 changed files with 139 additions and 166 deletions

View File

@@ -0,0 +1,113 @@
name: Mobile Release Assets
on:
workflow_call:
inputs:
tag_name:
required: true
type: string
release_name:
required: true
type: string
release_version:
required: true
type: string
prerelease:
required: true
type: boolean
generate_release_notes:
required: false
type: boolean
default: false
release_body:
required: true
type: string
permissions:
contents: write
jobs:
release:
name: Prepare assets and publish release
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
steps:
- name: Download Android APK artifact
uses: actions/download-artifact@v4.3.0
with:
name: app-release-apk
path: ${{ runner.temp }}/mobile-artifacts
if-no-files-found: error
- name: Download iOS build artifact
uses: actions/download-artifact@v4.3.0
with:
name: ios-build-unsigned
path: ${{ runner.temp }}/ios-build
if-no-files-found: error
- name: Prepare release assets
run: |
set -euo pipefail
RELEASE_VERSION="${{ inputs.release_version }}"
MOBILE_ARTIFACTS_DIR="${{ runner.temp }}/mobile-artifacts"
IOS_ARTIFACTS_DIR="${{ runner.temp }}/ios-build"
RELEASE_ASSETS_DIR="${{ runner.temp }}/release-assets"
mkdir -p "$RELEASE_ASSETS_DIR"
echo "=== Downloaded artifacts ==="
echo "Mobile artifacts:"
find "$MOBILE_ARTIFACTS_DIR" -maxdepth 6 -type f -print | sed 's#^# #' || true
echo "iOS build:"
find "$IOS_ARTIFACTS_DIR" -maxdepth 8 -type f -print | sed 's#^# #' || true
echo "==========================="
DEBUG_APK_PATH="$(find "$MOBILE_ARTIFACTS_DIR" -type f -name 'app-debug.apk' -print -quit || true)"
RELEASE_APK_PATH="$(find "$MOBILE_ARTIFACTS_DIR" -type f -name 'app-release.apk' -print -quit || true)"
IOS_RUNNER_DIR="$(find "$IOS_ARTIFACTS_DIR" -type d -name 'Runner.app' -print -quit || true)"
IOS_INFO_PATH="$(find "$IOS_ARTIFACTS_DIR" -type f -name 'ios-build-info.txt' -print -quit || true)"
if [ -n "$DEBUG_APK_PATH" ]; then
cp "$DEBUG_APK_PATH" "${{ runner.temp }}/release-assets/sure-${RELEASE_VERSION}-debug.apk"
echo "✓ Debug APK prepared"
fi
if [ -n "$RELEASE_APK_PATH" ]; then
cp "$RELEASE_APK_PATH" "${{ runner.temp }}/release-assets/sure-${RELEASE_VERSION}.apk"
echo "✓ Release APK prepared"
fi
if [ -n "$IOS_RUNNER_DIR" ]; then
cd "$IOS_RUNNER_DIR/.."
zip -r "${{ runner.temp }}/release-assets/sure-${RELEASE_VERSION}-ios-unsigned.zip" Runner.app
echo "✓ iOS build archive prepared"
fi
if [ -n "$IOS_INFO_PATH" ]; then
cp "$IOS_INFO_PATH" "${{ runner.temp }}/release-assets/"
echo "✓ iOS build info prepared"
fi
echo "Release assets:"
ls -la "${{ runner.temp }}/release-assets/"
if [ -z "$(ls -A "${{ runner.temp }}/release-assets/")" ]; then
echo "::error::No release assets were produced"
exit 1
fi
echo "✓ Assets prepared for release"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.tag_name }}
name: ${{ inputs.release_name }}
draft: false
prerelease: ${{ inputs.prerelease }}
generate_release_notes: ${{ inputs.generate_release_notes }}
files: ${{ runner.temp }}/release-assets/*
body: ${{ inputs.release_body }}

View File

@@ -17,98 +17,19 @@ jobs:
release:
name: Create Mobile GitHub Release
needs: [build]
runs-on: ubuntu-latest
timeout-minutes: 10
uses: ./.github/workflows/mobile-release-assets.yml
with:
tag_name: ${{ github.ref_name }}
release_name: "${{ replace(github.ref_name, 'mobile-', '') }} (Mobile)"
release_version: ${{ replace(github.ref_name, 'mobile-', '') }}
prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }}
generate_release_notes: false
release_body: |
## Mobile Debug Builds
permissions:
contents: write
This release includes mobile debug builds. Download from the `Assets` area below.
steps:
- name: Extract version from tag
id: version
run: |
# Strip 'mobile-' prefix to get the version part (e.g., 'mobile-v1.0.0' -> 'v1.0.0')
VERSION="${GITHUB_REF_NAME#mobile-}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Extracted version: $VERSION"
- **Android APK**: Debug build for testing on Android devices
- **iOS Build**: Unsigned iOS build (requires code signing for installation)
- name: Download Android APK artifact
uses: actions/download-artifact@v4.3.0
with:
name: app-release-apk
path: ${{ runner.temp }}/mobile-artifacts
- name: Download iOS build artifact
uses: actions/download-artifact@v4.3.0
with:
name: ios-build-unsigned
path: ${{ runner.temp }}/ios-build
- name: Prepare release assets
run: |
set -euo pipefail
mkdir -p ${{ runner.temp }}/release-assets
echo "=== Downloaded artifacts ==="
echo "Mobile artifacts:"
ls -laR "${{ runner.temp }}/mobile-artifacts" || echo "No mobile-artifacts directory"
echo "iOS build:"
ls -laR "${{ runner.temp }}/ios-build" || echo "No ios-build directory"
echo "==========================="
# Copy debug APK if it exists
if [ -f "${{ runner.temp }}/mobile-artifacts/app-debug.apk" ]; then
cp "${{ runner.temp }}/mobile-artifacts/app-debug.apk" \
"${{ runner.temp }}/release-assets/sure-${{ steps.version.outputs.version }}-debug.apk"
echo "✓ Debug APK prepared"
fi
# Copy release APK if it exists
if [ -f "${{ runner.temp }}/mobile-artifacts/app-release.apk" ]; then
cp "${{ runner.temp }}/mobile-artifacts/app-release.apk" \
"${{ runner.temp }}/release-assets/sure-${{ steps.version.outputs.version }}.apk"
echo "✓ Release APK prepared"
fi
# Create iOS app archive (zip the .app bundle)
if [ -d "${{ runner.temp }}/ios-build/ios/iphoneos/Runner.app" ]; then
cd "${{ runner.temp }}/ios-build/ios/iphoneos"
zip -r "${{ runner.temp }}/release-assets/sure-${{ steps.version.outputs.version }}-ios-unsigned.zip" Runner.app
echo "✓ iOS build archive prepared"
fi
# Copy iOS build info
if [ -f "${{ runner.temp }}/ios-build/ios-build-info.txt" ]; then
cp "${{ runner.temp }}/ios-build/ios-build-info.txt" "${{ runner.temp }}/release-assets/"
fi
echo "Release assets:"
ls -la "${{ runner.temp }}/release-assets/"
# Fail early if no assets were produced
if [ -z "$(ls -A "${{ runner.temp }}/release-assets/")" ]; then
echo "::error::No release assets were produced"
exit 1
fi
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: "${{ steps.version.outputs.version }} (Mobile)"
draft: false
prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }}
generate_release_notes: false
files: |
${{ runner.temp }}/release-assets/*
body: |
## Mobile-Only Release: ${{ steps.version.outputs.version }}
This is a mobile-only release. It does not include server-side changes.
### Downloads
- **Android APK**: Debug build for testing on Android devices
- **iOS Build**: Unsigned iOS build (requires code signing for installation)
> **Note**: These are builds intended for testing purposes. For production use, please build from source with proper signing credentials.
> **Note**: These are debug builds intended for testing purposes. For production use, please build from source with proper signing credentials.

View File

@@ -251,83 +251,22 @@ jobs:
name: Create GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
needs: [merge, mobile]
runs-on: ubuntu-latest
timeout-minutes: 10
uses: ./.github/workflows/mobile-release-assets.yml
with:
tag_name: ${{ github.ref_name }}
release_name: ${{ github.ref_name }}
release_version: ${{ github.ref_name }}
prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }}
generate_release_notes: true
release_body: |
## Mobile Debug Builds
permissions:
contents: write
This release includes debug builds of the mobile applications. Download from the `Assets` area below.
steps:
- name: Download Android APK artifact
uses: actions/download-artifact@v4.3.0
with:
name: app-release-apk
path: ${{ runner.temp }}/mobile-artifacts
- **Android APK**: Debug build for testing on Android devices
- **iOS Build**: Unsigned iOS build (requires code signing for installation)
- name: Download iOS build artifact
uses: actions/download-artifact@v4.3.0
with:
name: ios-build-unsigned
path: ${{ runner.temp }}/ios-build
- name: Prepare release assets
run: |
mkdir -p ${{ runner.temp }}/release-assets
echo "=== Debugging: List downloaded artifacts ==="
echo "Mobile artifacts:"
ls -laR "${{ runner.temp }}/mobile-artifacts" || echo "No mobile-artifacts directory"
echo "iOS build:"
ls -laR "${{ runner.temp }}/ios-build" || echo "No ios-build directory"
echo "==========================================="
# Copy debug APK if it exists
if [ -f "${{ runner.temp }}/mobile-artifacts/app-debug.apk" ]; then
cp "${{ runner.temp }}/mobile-artifacts/app-debug.apk" "${{ runner.temp }}/release-assets/sure-${{ github.ref_name }}-debug.apk"
echo "✓ Debug APK prepared"
fi
# Copy release APK if it exists
if [ -f "${{ runner.temp }}/mobile-artifacts/app-release.apk" ]; then
cp "${{ runner.temp }}/mobile-artifacts/app-release.apk" "${{ runner.temp }}/release-assets/sure-${{ github.ref_name }}.apk"
echo "✓ Release APK prepared"
fi
# Create iOS app archive (zip the .app bundle)
# Path preserves directory structure from artifact upload
if [ -d "${{ runner.temp }}/ios-build/ios/iphoneos/Runner.app" ]; then
cd "${{ runner.temp }}/ios-build/ios/iphoneos"
zip -r "${{ runner.temp }}/release-assets/sure-${{ github.ref_name }}-ios-unsigned.zip" Runner.app
echo "✓ iOS build archive prepared"
fi
# Copy iOS build info
if [ -f "${{ runner.temp }}/ios-build/ios-build-info.txt" ]; then
cp "${{ runner.temp }}/ios-build/ios-build-info.txt" "${{ runner.temp }}/release-assets/"
fi
echo "Release assets:"
ls -la "${{ runner.temp }}/release-assets/"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
draft: false
prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }}
generate_release_notes: true
files: |
${{ runner.temp }}/release-assets/*
body: |
## Mobile Debug Builds
This release includes debug builds of the mobile applications. Download from the `Assets` area below.
- **Android APK**: Debug build for testing on Android devices
- **iOS Build**: Unsigned iOS build (requires code signing for installation)
> **Note**: These are debug builds intended for testing purposes. For production use, please build from source with proper signing credentials.
> **Note**: These are debug builds intended for testing purposes. For production use, please build from source with proper signing credentials.
bump-pre_release-version:
name: Bump Pre-release Version