ci: merge tmp/publish-test — add publish workflow #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Android Release | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true' | |
| jobs: | |
| build-android: | |
| runs-on: ubuntu-latest | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Install Android command-line tools and SDK components (API 29) | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y unzip wget | |
| ANDROID_SDK_ROOT=$HOME/Android/Sdk | |
| mkdir -p $ANDROID_SDK_ROOT | |
| # Download command-line tools (Linux) | |
| wget -q https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip -O /tmp/cmdline-tools.zip | |
| unzip -q /tmp/cmdline-tools.zip -d /tmp/cmdline-tools | |
| mkdir -p $ANDROID_SDK_ROOT/cmdline-tools/latest | |
| mv /tmp/cmdline-tools/cmdline-tools/* $ANDROID_SDK_ROOT/cmdline-tools/latest/ | |
| # Expose SDK paths for this and subsequent steps | |
| echo "ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" >> $GITHUB_ENV | |
| echo "$ANDROID_SDK_ROOT/cmdline-tools/latest/bin" >> $GITHUB_PATH | |
| echo "$ANDROID_SDK_ROOT/platform-tools" >> $GITHUB_PATH | |
| export PATH="$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$PATH" | |
| # Accept licenses and install required components | |
| yes | sdkmanager --sdk_root=$ANDROID_SDK_ROOT --licenses || true | |
| sdkmanager --sdk_root=$ANDROID_SDK_ROOT "platform-tools" "platforms;android-29" "build-tools;29.0.3" | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| channel: 'stable' | |
| - name: Cache pub and Gradle | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.pub-cache | |
| ~/.gradle/caches | |
| key: ${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.yaml') }}-${{ hashFiles('**/gradle-wrapper.properties') }} | |
| - name: Flutter pub get | |
| run: flutter pub get | |
| - name: Accept Android SDK licenses | |
| run: | | |
| yes | sdkmanager --licenses || true | |
| - name: Build Android App Bundle (AAB) | |
| run: flutter build appbundle --release --target-platform android-arm,android-arm64 | |
| - name: Build Android APK (debug, installable for testing) | |
| run: flutter build apk --debug | |
| - name: Prepare release metadata | |
| id: vars | |
| run: | | |
| now=$(date -u +%y%m%d) | |
| short=$(git rev-parse --short=6 HEAD) | |
| base_no_prefix="$now-$short" | |
| release_tag="picoclaw_fui-$base_no_prefix" | |
| echo "Computed release base_no_prefix: $base_no_prefix" | |
| echo "release_tag=$release_tag" >> $GITHUB_OUTPUT | |
| echo "RELEASE_BASE=$base_no_prefix" >> $GITHUB_ENV | |
| echo "RELEASE_TAG=$release_tag" >> $GITHUB_ENV | |
| - name: Collect and rename Android artifacts | |
| run: | | |
| set -e | |
| PKG_NAME=picoclaw_fui | |
| TAG=${RELEASE_BASE} | |
| # target names: {base}-android-arm_arm64.aab and {base}-android-universal.apk | |
| AAB_NAME=${PKG_NAME}-${TAG}-android-arm_arm64.aab | |
| APK_NAME=${PKG_NAME}-${TAG}-android-universal.apk | |
| rm -f "$AAB_NAME" "$APK_NAME" || true | |
| if ls build/app/outputs/bundle/release/*.aab 1> /dev/null 2>&1; then | |
| cp build/app/outputs/bundle/release/*.aab "$AAB_NAME" | |
| else | |
| echo "AAB not found"; exit 1 | |
| fi | |
| if [ -f build/app/outputs/flutter-apk/app-debug.apk ]; then | |
| cp build/app/outputs/flutter-apk/app-debug.apk "$APK_NAME" | |
| else | |
| echo "Debug APK not found"; exit 1 | |
| fi | |
| - name: Upload AAB artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: picoclaw_fui-${{ env.RELEASE_BASE }}-android-arm_arm64.aab | |
| path: picoclaw_fui-${{ env.RELEASE_BASE }}-android-arm_arm64.aab | |
| - name: Upload APK artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: picoclaw_fui-${{ env.RELEASE_BASE }}-android-universal.apk | |
| path: picoclaw_fui-${{ env.RELEASE_BASE }}-android-universal.apk |