Fastlane: Build and release Android App to Google Play #6
Workflow file for this run
This file contains 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: "Fastlane: Build and release Android App to Google Play" | |
on: | |
workflow_call: | |
inputs: | |
coordinator_port_http: | |
required: true | |
type: string | |
electrs_endpoint: | |
required: true | |
type: string | |
coordinator_p2p_endpoint: | |
required: true | |
type: string | |
network: | |
required: true | |
type: string | |
description: "The target network for the release, e.g. mainnet/regtest" | |
tag: | |
required: true | |
description: "The branch, tag or SHA to checkout." | |
type: string | |
oracle_endpoint: | |
required: true | |
type: string | |
oracle_pubkey: | |
required: true | |
description: "The public key of the oracle. Must match with the public key returned at http://${oracle_endpoint}/oracle/publickey" | |
type: string | |
meme_endpoint: | |
required: true | |
description: "The url where our memes are being hosted" | |
type: string | |
workflow_dispatch: | |
inputs: | |
coordinator_port_http: | |
required: true | |
description: "The coordinator's http port" | |
type: string | |
electrs_endpoint: | |
required: true | |
description: "Electrs http url" | |
type: string | |
coordinator_p2p_endpoint: | |
required: true | |
description: "The coordinator's p2p endpoint" | |
type: string | |
network: | |
required: true | |
type: string | |
description: "The target network for the release, e.g. mainnet/regtest" | |
tag: | |
required: true | |
description: "The branch, tag or SHA to checkout." | |
type: string | |
oracle_endpoint: | |
required: true | |
description: "The oracle's http url" | |
type: string | |
oracle_pubkey: | |
required: true | |
description: "The public key of the oracle. Must match with the public key returned at http://${oracle_endpoint}/oracle/publickey" | |
type: string | |
meme_endpoint: | |
required: true | |
description: "The url where our memes are being hosted" | |
type: string | |
jobs: | |
build: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# fetch the complete history to correctly calculate build_number | |
fetch-depth: 0 | |
ref: ${{ inputs.tag }} | |
- name: List installations Xcode version | |
run: sudo ls -1 /Applications | grep "Xcode" | |
- name: List used Xcode version | |
run: /usr/bin/xcodebuild -version | |
- uses: ./.github/actions/setup-fvm | |
with: | |
fvm_config: ./mobile/.fvmrc | |
working_dir: ./mobile | |
- name: Install just | |
run: cargo install just --force | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: "temurin" | |
java-version: "17.x" | |
cache: "gradle" | |
- name: Install fastlane | |
run: | | |
cd mobile/android/fastlane | |
gem install bundler | |
bundle install | |
bundle info fastlane | |
- name: Install FFI bindings | |
run: just deps-gen --force | |
- name: Add Rust targets | |
run: rustup target add armv7-linux-androideabi aarch64-linux-android | |
# #499, https://github.com/actions/virtual-environments/issues/5595 | |
- name: Configure ndk | |
run: | | |
ANDROID_HOME=$HOME/Library/Android/sdk | |
SDKMANAGER=$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager | |
echo y | $SDKMANAGER "ndk;21.4.7075529" | |
ln -sfn $ANDROID_HOME/ndk/21.4.7075529 $ANDROID_HOME/ndk-bundle | |
- name: Install cargo ndk | |
run: cargo install cargo-ndk --force | |
- name: Generate FFI bindings | |
run: just gen | |
- name: Build android Rust lib in release mode | |
run: just android-release | |
- name: Parse version from pubspec.yaml | |
id: version | |
uses: jbutcher5/[email protected] | |
with: | |
file: "mobile/pubspec.yaml" | |
key-path: '["version"]' | |
- name: Prepare signingkeys | |
env: | |
# secrets | |
FASTLANE_ANDROID_SERVICE_ACCOUNT_KEY_BASE64: ${{ secrets.FASTLANE_ANDROID_SERVICE_ACCOUNT_KEY_BASE64 }} | |
FASTLANE_ANDROID_UPLOAD_KEY_BASE64: ${{ secrets.FASTLANE_ANDROID_UPLOAD_KEY_BASE64 }} | |
FASTLANE_ANDROID_STORE_PASSWORD: ${{ secrets.FASTLANE_ANDROID_STORE_PASSWORD }} | |
run: | | |
echo "$FASTLANE_ANDROID_SERVICE_ACCOUNT_KEY_BASE64" | base64 --decode > ${{ runner.temp }}/fastlane_service_account.json | |
echo "$FASTLANE_ANDROID_UPLOAD_KEY_BASE64" | base64 --decode > ${{ runner.temp }}/upload-keystore.jks | |
upload_keystore_content="storePassword=$FASTLANE_ANDROID_STORE_PASSWORD | |
keyPassword=$FASTLANE_ANDROID_STORE_PASSWORD | |
keyAlias=upload | |
storeFile=${{ runner.temp }}/upload-keystore.jks" | |
echo "$upload_keystore_content" > "./mobile/android/key.properties" | |
- name: Build Android Archive | |
id: build-android-archive | |
run: | | |
NETWORK=$NETWORK just build-android-app-bundle | |
env: | |
ELECTRS_ENDPOINT: ${{ inputs.electrs_endpoint }} | |
COORDINATOR_P2P_ENDPOINT: ${{ inputs.coordinator_p2p_endpoint }} | |
NETWORK: ${{ inputs.network }} | |
COORDINATOR_PORT_HTTP: ${{ inputs.coordinator_port_http }} | |
ORACLE_ENDPOINT: ${{ inputs.oracle_endpoint }} | |
ORACLE_PUBKEY: ${{ inputs.oracle_pubkey }} | |
MEME_ENDPOINT: ${{ inputs.meme_endpoint }} | |
- name: Build Android APK for each platform | |
run: | | |
NETWORK=$NETWORK just build-android-app-apk --split-per-abi | |
env: | |
ELECTRS_ENDPOINT: ${{ inputs.electrs_endpoint }} | |
COORDINATOR_P2P_ENDPOINT: ${{ inputs.coordinator_p2p_endpoint }} | |
NETWORK: ${{ inputs.network }} | |
COORDINATOR_PORT_HTTP: ${{ inputs.coordinator_port_http }} | |
ORACLE_ENDPOINT: ${{ inputs.oracle_endpoint }} | |
ORACLE_PUBKEY: ${{ inputs.oracle_pubkey }} | |
MEME_ENDPOINT: ${{ inputs.meme_endpoint }} | |
- name: Build Android APK fat bundle | |
run: | | |
NETWORK=$NETWORK just build-android-app-apk | |
env: | |
ELECTRS_ENDPOINT: ${{ inputs.electrs_endpoint }} | |
COORDINATOR_P2P_ENDPOINT: ${{ inputs.coordinator_p2p_endpoint }} | |
NETWORK: ${{ inputs.network }} | |
COORDINATOR_PORT_HTTP: ${{ inputs.coordinator_port_http }} | |
ORACLE_ENDPOINT: ${{ inputs.oracle_endpoint }} | |
ORACLE_PUBKEY: ${{ inputs.oracle_pubkey }} | |
MEME_ENDPOINT: ${{ inputs.meme_endpoint }} | |
- name: Attach android apks to release | |
uses: softprops/action-gh-release@v2 | |
if: ${{ inputs.tag != 'main' }} | |
with: | |
tag_name: ${{ inputs.tag }} | |
files: | | |
mobile/build/app/outputs/flutter-apk/*.apk | |
mobile/build/app/outputs/flutter-apk/*.apk.sha1 | |
- name: Compute the release tag for continues ci build | |
if: ${{ inputs.tag == 'main' }} | |
run: | | |
echo "release_tag=v`date '+%Y-%m-%d %H:%M:%S'`" >> $GITHUB_ENV | |
- name: Attach android apks to release | |
uses: softprops/action-gh-release@v2 | |
if: ${{ inputs.tag == 'main' }} | |
with: | |
prerelease: true | |
name: ${{ env.release_tag }} | |
tag_name: ${{ env.release_tag }} | |
target_commitish: main | |
make_latest: false | |
repository: get10101/10101-test-apks | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: | | |
mobile/build/app/outputs/flutter-apk/*.apk | |
mobile/build/app/outputs/flutter-apk/*.apk.sha1 | |
- name: Release to Google Play Store | |
env: | |
# secrets | |
FASTLANE_ANDROID_SERVICE_ACCOUNT_KEY_BASE64: ${{ secrets.FASTLANE_ANDROID_SERVICE_ACCOUNT_KEY_BASE64 }} | |
FASTLANE_ANDROID_UPLOAD_KEY_BASE64: ${{ secrets.FASTLANE_ANDROID_UPLOAD_KEY_BASE64 }} | |
FASTLANE_ANDROID_STORE_PASSWORD: ${{ secrets.FASTLANE_ANDROID_STORE_PASSWORD }} | |
NETWORK: ${{ inputs.network }} | |
run: | | |
NETWORK=$NETWORK ANDROID_SERVICE_ACCOUNT_KEY=${{ runner.temp }}/fastlane_service_account.json just upload-app-bundle | |
rm ${{ runner.temp }}/fastlane_service_account.json |