Skip to content

Workflow file for this run

name: Create release and upload to Apple and Google
on:
push:
tags:
# Only builds for tags with a meaningless build number suffix: v1.0.0-1
- 'v[0-9]+.[0-9]+.[0-9]+-*'
jobs:
build:
name: Build ios and android package
runs-on: macos-latest
steps:
- name: Set up Go 1.20
uses: actions/setup-go@v4
with:
go-version: "1.20"
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
- name: Install flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.3.5'
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r21b
# r21b is 21.1.6352462, if it is not published here https://developer.android.com/ndk/downloads
# or here https://github.com/android/ndk/wiki/Unsupported-Downloads then you must download them and look at
# source.properties to determine the version
- name: Check out code
uses: actions/checkout@v3
- name: Configure git for private modules
env:
TOKEN: ${{ secrets.MACHINE_USER_PAT }}
run: git config --global url."https://defined-machine:${TOKEN}@github.com".insteadOf "https://github.com"
- name: Install the appstore connect key material
env:
AC_API_KEY_SECRET_BASE64: ${{ secrets.AC_API_KEY_SECRET_BASE64 }}
run: |
AC_API_KEY_SECRET_PATH="$RUNNER_TEMP/key.p8"
echo "APP_STORE_CONNECT_API_KEY_KEY_FILEPATH=$AC_API_KEY_SECRET_PATH" >> $GITHUB_ENV
echo -n "$AC_API_KEY_SECRET_BASE64" | base64 --decode --output "$AC_API_KEY_SECRET_PATH"
- name: Install the google play key material
env:
GOOGLE_PLAY_API_JWT_BASE64: ${{ secrets.GOOGLE_PLAY_API_JWT_BASE64 }}
GOOGLE_PLAY_KEYSTORE_BASE64: ${{ secrets.GOOGLE_PLAY_KEYSTORE_BASE64 }}
run: |
GOOGLE_PLAY_API_JWT_PATH="$RUNNER_TEMP/gp_api.json"
echo "GOOGLE_PLAY_API_JWT_PATH=$GOOGLE_PLAY_API_JWT_PATH" >> $GITHUB_ENV
echo -n "$GOOGLE_PLAY_API_JWT_BASE64" | base64 --decode --output "$GOOGLE_PLAY_API_JWT_PATH"
GOOGLE_PLAY_KEYSTORE_PATH="$RUNNER_TEMP/gp_signing.jks"
echo "GOOGLE_PLAY_KEYSTORE_PATH=$GOOGLE_PLAY_KEYSTORE_PATH" >> $GITHUB_ENV
echo -n "$GOOGLE_PLAY_KEYSTORE_BASE64" | base64 --decode --output "$GOOGLE_PLAY_KEYSTORE_PATH"
- name: Get build name and number, install dependencies
run: |
go install golang.org/x/mobile/cmd/gomobile@latest
gomobile init
flutter pub get
touch env.sh
cd android
fastlane release_build_number
echo "BUILD_NUMBER=$(cat ../release_build_number)" >> $GITHUB_ENV
BUILD_NAME="${GITHUB_REF#refs/tags/v}" # strip the front refs/tags/v off
BUILD_NAME="${BUILD_NAME%-*}" # strip the junk build number off
echo "BUILD_NAME=$BUILD_NAME" >> $GITHUB_ENV
- name: Build iOS
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
run: |
cd ios
pod install
fastlane build
- name: Collect iOS artifacts
uses: actions/upload-artifact@v3
with:
name: MobileNebula.ipa
path: ios/MobileNebula.ipa
retention-days: 5
- name: Build Android
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
GOOGLE_PLAY_KEYSTORE_PASSWORD: ${{ secrets.GOOGLE_PLAY_KEYSTORE_PASSWORD }}
run: |
flutter build appbundle --build-number="$BUILD_NUMBER" --build-name="$BUILD_NAME"
- name: Collect Android artifacts
uses: actions/upload-artifact@v3
with:
name: MobileNebula.aab
path: build/app/outputs/bundle/release/app-release.aab
retention-days: 5
- name: Publish to iOS TestFlight
env:
APP_STORE_CONNECT_API_KEY_KEY_ID: ${{ secrets.AC_API_KEY_ID }}
APP_STORE_CONNECT_API_KEY_ISSUER_ID: ${{ secrets.AC_API_KEY_ISSUER_ID }}
run: |
cd ios
fastlane release
- name: Publish to Android internal track
run: |
cd android
fastlane release
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: false
- name: Upload release Android app
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/app/outputs/bundle/release/app-release.aab
asset_name: MobileNebula.aab
asset_content_type: text/plain
- name: Upload release iOS app
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ios/MobileNebula.ipa
asset_name: MobileNebula.ipa
asset_content_type: text/plain