Skip to content

Commit

Permalink
Add firebase test_lab procedure
Browse files Browse the repository at this point in the history
  • Loading branch information
PrimozRatej committed Aug 1, 2024
1 parent 0c07900 commit a61acae
Showing 1 changed file with 148 additions and 127 deletions.
275 changes: 148 additions & 127 deletions .github/workflows/version-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: version-release

on:
push:
tags:
- "v*"
branches:
- '189-targeted-android-versions'

jobs:
version:
Expand Down Expand Up @@ -102,135 +102,156 @@ jobs:
name: appbundle
path: build/app/outputs/bundle/release/app-release.aab

release_android:
name: Release APK to Google Play
needs: [build_android]
firebase_test_lab:
name: Test APK in Firebase Test Lab
needs: [ build_android ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get appbundle from artifacts
uses: actions/download-artifact@v3
with:
name: appbundle
- name: Release app to internal track
uses: r0adkll/upload-google-play@v1
- name: Upload APK to Google Cloud Storage
uses: google-github-actions/[email protected]
with:
serviceAccountJsonPlainText: ${{ secrets.PLAYSTORE_ACCOUNT_KEY }}
packageName: com.humhub.app
releaseFiles: app-release.aab
track: internal
status: completed

build_ios:
name: Build IPA
needs: [version]
runs-on: macos-13
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install the Apple certificate and provisioning profile
path: build/app/outputs/apk/release/app-release.apk
bucket: ${{ secrets.GCP_BUCKET_NAME }}
destination: app-release.apk
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.APPSTORE_BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.APPSTORE_P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.APPSTORE_BUILD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.APPSTORE_KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Install Flutter
uses: subosito/flutter-action@v1
with:
flutter-version: '3.19.0'
channel: 'stable'

- name: Install pub dependencies
run: flutter pub get

- name: Extract version
id: extract_version
run: echo "version=$(echo ${{ github.ref }} | sed -e 's/^refs\/tags\/v//' -e 's/-.*//')" >> $GITHUB_ENV

- name: Extract version code
id: extract_version_code
run: echo "version_code=$(git rev-list --count HEAD)" >> $GITHUB_ENV

- name: Update Info.plist version and build number
uses: damienaicheh/[email protected]
with:
info-plist-path: 'ios/Runner/Info.plist'
bundle-short-version-string: '${{ env.version }}'
bundle-version: ${{ env.version_code }}
print-file: true
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.PLAYSTORE_ACCOUNT_KEY }}

- name: Build IPA
run: flutter build ipa --release --export-options-plist=ios/Runner/ExportOptions.plist

- name: Create release
uses: ncipollo/release-action@v1
with:
artifacts: "build/ios/ipa/*.ipa"
token: ${{ github.token }}
commit: ${{ github.sha }}
allowUpdates: true

- name: Collect IPA artifacts
uses: actions/upload-artifact@v2
with:
name: releaseipa
path: build/ios/ipa/*.ipa

# Important! Cleanup: remove the certificate and provisioning profile from the runner!
- name: Clean up keychain and provisioning profile
if: ${{ always() }}
- name: Run Firebase Test Lab tests
run: |
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db
rm ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.mobileprovision
gcloud firebase test android run --type robo --app gs://${{ secrets.GCP_BUCKET_NAME }}/app-release.apk --device model=Pixel4,version=30
env:
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.PLAYSTORE_ACCOUNT_KEY }}

release_ios:
name: Release IPA to TestFlight
needs: [ build_ios ]
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get IPA from artifacts
uses: actions/download-artifact@v3
with:
name: releaseipa
path: build/ios/ipa
- name: Upload app to TestFlight
uses: apple-actions/upload-testflight-build@v1
with:
app-path: build/ios/ipa/humhub.ipa
issuer-id: ${{ secrets.APPSTORE_APP_API_ISSUER_ID }}
api-key-id: ${{ secrets.APPSTORE_API_KEY_ID }}
api-private-key: ${{ secrets.APPSTORE_APP_API_PRIVATE_KEY }}
# release_android:
# name: Release APK to Google Play
# needs: [build_android]
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# with:
# fetch-depth: 0
# - name: Get appbundle from artifacts
# uses: actions/download-artifact@v3
# with:
# name: appbundle
# - name: Release app to internal track
# uses: r0adkll/upload-google-play@v1
# with:
# serviceAccountJsonPlainText: ${{ secrets.PLAYSTORE_ACCOUNT_KEY }}
# packageName: com.humhub.app
# releaseFiles: app-release.aab
# track: internal
# status: completed
#
# build_ios:
# name: Build IPA
# needs: [version]
# runs-on: macos-13
# permissions:
# contents: write
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# with:
# fetch-depth: 0
# - name: Install the Apple certificate and provisioning profile
# env:
# BUILD_CERTIFICATE_BASE64: ${{ secrets.APPSTORE_BUILD_CERTIFICATE_BASE64 }}
# P12_PASSWORD: ${{ secrets.APPSTORE_P12_PASSWORD }}
# BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.APPSTORE_BUILD_PROVISION_PROFILE_BASE64 }}
# KEYCHAIN_PASSWORD: ${{ secrets.APPSTORE_KEYCHAIN_PASSWORD }}
# run: |
# # create variables
# CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
# PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
# KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
#
# # import certificate and provisioning profile from secrets
# echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
# echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
#
# # create temporary keychain
# security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
# security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
#
# # import certificate to keychain
# security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
# security list-keychain -d user -s $KEYCHAIN_PATH
#
# # apply provisioning profile
# mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
# cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
#
# - name: Install Flutter
# uses: subosito/flutter-action@v1
# with:
# flutter-version: '3.19.0'
# channel: 'stable'
#
# - name: Install pub dependencies
# run: flutter pub get
#
# - name: Extract version
# id: extract_version
# run: echo "version=$(echo ${{ github.ref }} | sed -e 's/^refs\/tags\/v//' -e 's/-.*//')" >> $GITHUB_ENV
#
# - name: Extract version code
# id: extract_version_code
# run: echo "version_code=$(git rev-list --count HEAD)" >> $GITHUB_ENV
#
# - name: Update Info.plist version and build number
# uses: damienaicheh/[email protected]
# with:
# info-plist-path: 'ios/Runner/Info.plist'
# bundle-short-version-string: '${{ env.version }}'
# bundle-version: ${{ env.version_code }}
# print-file: true
#
# - name: Build IPA
# run: flutter build ipa --release --export-options-plist=ios/Runner/ExportOptions.plist
#
# - name: Create release
# uses: ncipollo/release-action@v1
# with:
# artifacts: "build/ios/ipa/*.ipa"
# token: ${{ github.token }}
# commit: ${{ github.sha }}
# allowUpdates: true
#
# - name: Collect IPA artifacts
# uses: actions/upload-artifact@v2
# with:
# name: releaseipa
# path: build/ios/ipa/*.ipa
#
# # Important! Cleanup: remove the certificate and provisioning profile from the runner!
# - name: Clean up keychain and provisioning profile
# if: ${{ always() }}
# run: |
# security delete-keychain $RUNNER_TEMP/app-signing.keychain-db
# rm ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.mobileprovision
#
#
# release_ios:
# name: Release IPA to TestFlight
# needs: [ build_ios ]
# runs-on: macos-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# with:
# fetch-depth: 0
# - name: Get IPA from artifacts
# uses: actions/download-artifact@v3
# with:
# name: releaseipa
# path: build/ios/ipa
# - name: Upload app to TestFlight
# uses: apple-actions/upload-testflight-build@v1
# with:
# app-path: build/ios/ipa/humhub.ipa
# issuer-id: ${{ secrets.APPSTORE_APP_API_ISSUER_ID }}
# api-key-id: ${{ secrets.APPSTORE_API_KEY_ID }}
# api-private-key: ${{ secrets.APPSTORE_APP_API_PRIVATE_KEY }}

0 comments on commit a61acae

Please sign in to comment.