2022-10-03 20:30:39 +00:00
|
|
|
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
|
2022-10-03 21:03:49 +00:00
|
|
|
- 'v[0-9]+.[0-9]+.[0-9]+-*'
|
2022-10-03 20:30:39 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Build ios and android package
|
|
|
|
runs-on: macos-latest
|
|
|
|
|
|
|
|
steps:
|
2024-10-25 15:55:16 +00:00
|
|
|
- name: Check out code
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
show-progress: false
|
|
|
|
|
2024-06-20 19:24:00 +00:00
|
|
|
- name: Set up Go 1.22
|
2024-10-25 15:55:16 +00:00
|
|
|
uses: actions/setup-go@v5
|
2022-10-03 20:30:39 +00:00
|
|
|
with:
|
2024-06-20 19:24:00 +00:00
|
|
|
go-version: "1.22"
|
2024-10-25 15:55:16 +00:00
|
|
|
cache-dependency-path: nebula/go.sum
|
2022-10-03 20:30:39 +00:00
|
|
|
|
2024-10-25 15:55:16 +00:00
|
|
|
- uses: actions/setup-java@v4
|
2022-10-03 20:30:39 +00:00
|
|
|
with:
|
|
|
|
distribution: 'zulu'
|
2024-10-07 12:22:21 +00:00
|
|
|
java-version: '17'
|
2022-10-03 20:30:39 +00:00
|
|
|
|
|
|
|
- name: Install flutter
|
|
|
|
uses: subosito/flutter-action@v2
|
|
|
|
with:
|
2024-09-20 18:19:23 +00:00
|
|
|
flutter-version: '3.24.1'
|
2022-10-03 20:30:39 +00:00
|
|
|
|
2024-10-25 16:20:04 +00:00
|
|
|
- name: Setup bundletool for APK generation
|
|
|
|
uses: amyu/setup-bundletool@f7a6fdd8e04bb23d2fdf3c2f60c9257a6298a40a
|
|
|
|
|
2022-10-03 20:30:39 +00:00
|
|
|
- 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"
|
2024-01-31 20:42:45 +00:00
|
|
|
|
2022-10-03 20:30:39 +00:00
|
|
|
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"
|
|
|
|
|
2024-01-31 20:42:45 +00:00
|
|
|
- name: Place Github token for fastlane match
|
|
|
|
env:
|
|
|
|
TOKEN: ${{ secrets.MACHINE_USER_PAT }}
|
|
|
|
run:
|
|
|
|
echo "MATCH_GIT_BASIC_AUTHORIZATION=$(echo -n "defined-machine:${TOKEN}" | base64)" >> $GITHUB_ENV
|
|
|
|
|
2022-10-03 20:30:39 +00:00
|
|
|
- name: Get build name and number, install dependencies
|
2024-01-31 20:42:45 +00:00
|
|
|
env:
|
|
|
|
TOKEN: ${{ secrets.MACHINE_USER_PAT }}
|
2022-10-03 20:30:39 +00:00
|
|
|
run: |
|
|
|
|
go install golang.org/x/mobile/cmd/gomobile@latest
|
|
|
|
gomobile init
|
2024-01-31 20:42:45 +00:00
|
|
|
|
2022-10-03 20:30:39 +00:00
|
|
|
flutter pub get
|
2024-01-31 20:42:45 +00:00
|
|
|
|
2022-10-03 20:30:39 +00:00
|
|
|
touch env.sh
|
2024-01-31 20:42:45 +00:00
|
|
|
|
2022-10-03 20:30:39 +00:00
|
|
|
cd android
|
|
|
|
fastlane release_build_number
|
|
|
|
echo "BUILD_NUMBER=$(cat ../release_build_number)" >> $GITHUB_ENV
|
2022-10-03 22:45:56 +00:00
|
|
|
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
|
2022-10-03 20:30:39 +00:00
|
|
|
|
|
|
|
- name: Build iOS
|
|
|
|
env:
|
2024-01-31 20:42:45 +00:00
|
|
|
TOKEN: ${{ secrets.MACHINE_USER_PAT }}
|
2022-10-03 20:30:39 +00:00
|
|
|
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
|
|
|
|
run: |
|
|
|
|
cd ios
|
|
|
|
pod install
|
|
|
|
fastlane build
|
2024-01-31 20:42:45 +00:00
|
|
|
cd -
|
|
|
|
|
|
|
|
# verify that the github token didn't make it into the output
|
|
|
|
mkdir -p build/app/test-ios
|
|
|
|
cp ios/MobileNebula.ipa build/app/test-ios
|
|
|
|
cd build/app/test-ios
|
|
|
|
unzip MobileNebula.ipa
|
|
|
|
if find . | xargs strings 2>/dev/null | grep -qF "${TOKEN}" ; then
|
|
|
|
echo "Token found in iOS build"
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-10-03 20:30:39 +00:00
|
|
|
|
|
|
|
- name: Collect iOS artifacts
|
2024-10-25 15:55:16 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2022-10-03 20:30:39 +00:00
|
|
|
with:
|
|
|
|
name: MobileNebula.ipa
|
|
|
|
path: ios/MobileNebula.ipa
|
|
|
|
retention-days: 5
|
|
|
|
|
|
|
|
- name: Build Android
|
|
|
|
env:
|
2024-01-31 20:42:45 +00:00
|
|
|
TOKEN: ${{ secrets.MACHINE_USER_PAT }}
|
2022-10-03 20:30:39 +00:00
|
|
|
GOOGLE_PLAY_KEYSTORE_PASSWORD: ${{ secrets.GOOGLE_PLAY_KEYSTORE_PASSWORD }}
|
|
|
|
run: |
|
|
|
|
flutter build appbundle --build-number="$BUILD_NUMBER" --build-name="$BUILD_NAME"
|
|
|
|
|
2024-01-31 20:42:45 +00:00
|
|
|
# verify that the github token didn't make it into the output
|
|
|
|
mkdir -p build/app/test-android
|
|
|
|
cp build/app/outputs/bundle/release/app-release.aab build/app/test-android
|
|
|
|
cd build/app/test-android
|
|
|
|
unzip app-release.aab
|
|
|
|
if find . | xargs strings 2>/dev/null | grep -qF "${TOKEN}" ; then
|
|
|
|
echo "Token found in Android build"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-10-25 16:20:04 +00:00
|
|
|
- name: Generate universal APK
|
|
|
|
env:
|
|
|
|
TOKEN: ${{ secrets.MACHINE_USER_PAT }}
|
|
|
|
GOOGLE_PLAY_KEYSTORE_PASSWORD: ${{ secrets.GOOGLE_PLAY_KEYSTORE_PASSWORD }}
|
|
|
|
run: |
|
|
|
|
bundletool build-apks \
|
|
|
|
--bundle=build/app/outputs/bundle/release/app-release.aab \
|
|
|
|
--output=build/app/outputs/apk/release/MobileNebula.apks \
|
|
|
|
--mode=universal \
|
|
|
|
--ks=$GOOGLE_PLAY_KEYSTORE_PATH \
|
|
|
|
--ks-key-alias=key \
|
|
|
|
--ks-pass=pass:$GOOGLE_PLAY_KEYSTORE_PASSWORD
|
|
|
|
unzip -p build/app/outputs/apk/release/MobileNebula.apks universal.apk > build/app/outputs/apk/release/MobileNebula.apk
|
|
|
|
|
2022-10-03 20:30:39 +00:00
|
|
|
- name: Collect Android artifacts
|
2024-10-25 15:55:16 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2022-10-03 20:30:39 +00:00
|
|
|
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
|
|
|
|
|
2024-10-25 15:55:16 +00:00
|
|
|
- name: Rename app bundle
|
|
|
|
run: |
|
|
|
|
mv build/app/outputs/bundle/release/app-release.aab \
|
|
|
|
build/app/outputs/bundle/release/MobileNebula.aab
|
|
|
|
|
|
|
|
- name: Create GitHub Release
|
2022-10-03 20:30:39 +00:00
|
|
|
id: create_release
|
2024-10-25 15:55:16 +00:00
|
|
|
uses: softprops/action-gh-release@v2
|
2022-10-03 20:30:39 +00:00
|
|
|
with:
|
2024-10-25 15:55:16 +00:00
|
|
|
name: Release ${{ github.ref }}
|
2022-10-03 20:30:39 +00:00
|
|
|
draft: true
|
|
|
|
prerelease: false
|
2024-10-25 15:55:16 +00:00
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
files: |
|
|
|
|
build/app/outputs/bundle/release/MobileNebula.aab
|
2024-10-25 16:20:04 +00:00
|
|
|
build/app/outputs/apk/release/MobileNebula.apk
|
2024-10-25 15:55:16 +00:00
|
|
|
ios/MobileNebula.ipa
|
2022-10-03 20:30:39 +00:00
|
|
|
|
2024-10-29 13:14:49 +00:00
|
|
|
- name: Upload debug symbols to Sentry
|
|
|
|
run: flutter packages pub run sentry_dart_plugin
|
2024-11-01 15:36:59 +00:00
|
|
|
env:
|
|
|
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
|
|
|
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
|
|
|
|
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
|