Skip to content

Commit

Permalink
Merge pull request #473 from nimblehq/feature/471-add-test-upload-bui…
Browse files Browse the repository at this point in the history
…ld-to-firebase-workflows

[#471] [Feature] Add Test upload build to Firebase workflows
  • Loading branch information
vnntsu authored Apr 28, 2023
2 parents e99d0dc + 6d6f71b commit ebcb4cc
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 3 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/test_upload_build_to_firebase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Test Upload Build to Firebase

# SECRETS needed:
### SSH_PRIVATE_KEY for Match Repo
### MATCH_PASS
### FIREBASE_TOKEN
### STAGING_FIREBASE_APP_ID
### TEAM_ID

on:
pull_request

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build
runs-on: macOS-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install SSH key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Install Firebase-Tools
run: |
yarn global add firebase-tools
echo "$(yarn global bin)" >> $GITHUB_PATH
- name: Bundle install
run: bundle install

- name: Cache Pods
uses: actions/cache@v3
id: cocoapodCache
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Start Install Script for Template App
run: sh make.sh --bundle-id co.nimblehq.ios.templates --bundle-id-staging co.nimblehq.ios.templates.staging --project-name TemplateApp

- name: Start Setup Script for Template App Firebase Upload
run: sh set_up_test_firebase.sh
env:
MATCH_REPO: ${{ secrets.MATCH_REPO }}
STAGING_FIREBASE_APP_ID: ${{ secrets.STAGING_FIREBASE_APP_ID }}
TEAM_ID: ${{ secrets.TEAM_ID }}

- name: Set Up Test Project for Firebase
run: bundle exec fastlane setUpTestProject

- name: Sync Ad Hoc Code Signing
run: bundle exec fastlane syncAdHocStagingCodeSigning
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASS }}

- name: Build App and Distribute to Firebase
run: bundle exec fastlane buildStagingAndUploadToFirebase
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ format('v{0}({1})-{2}', env.VERSION_NUMBER, env.BUILD_NUMBER, env.TAG_TYPE) }}
path: |
${{ env.IPA_OUTPUT_PATH }}
${{ env.DSYM_OUTPUT_PATH }}
env:
TAG_TYPE: Staging_Firebase
4 changes: 2 additions & 2 deletions .github/workflows/test_upload_build_to_test_flight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ concurrency:
jobs:
build:
name: Build
runs-on: macOS-12
runs-on: macOS-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
- name: Set Up Test Project for App Store
run: bundle exec fastlane setUpTestProject

- name: Update Provision Profile
- name: Sync App Store Code Signing
run: bundle exec fastlane syncAppStoreCodeSigning
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASS }}
Expand Down
2 changes: 1 addition & 1 deletion fastlane/Constants/Secret.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ enum Secret {

static let keychainPassword = EnvironmentParser.string(key: "KEYCHAIN_PASSWORD")

static let firebaseCLIToken = EnvironmentParser.string(key: "FIREBASE_CLI_TOKEN")
static let firebaseCLIToken = EnvironmentParser.string(key: "FIREBASE_TOKEN")

static let appstoreConnectAPIKey = EnvironmentParser.string(key: "APPSTORE_CONNECT_API_KEY")

Expand Down
1 change: 1 addition & 0 deletions make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ git reset

if [[ -z "${CI}" ]]; then
rm -rf fastlane/Tests
rm -f set_up_test_firebase.sh
rm -f set_up_test_testflight.sh
sh deliverable_setup.sh
fi
Expand Down
12 changes: 12 additions & 0 deletions set_up_test_firebase.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
readonly CONSTANT_TEAM_ID="<#teamId#>"
readonly CONSTANT_STAGING_FIREBASE_APP_ID="<#stagingFirebaseAppId#>"
readonly CONSTANT_FIREBASE_TESTER_GROUPS="<#group1#>, <#group2#>"
readonly CONSTANT_MATCH_REPO="[email protected]:{organization}\/{repo}.git"

readonly WORKING_DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
MATCH_REPO_ESCAPED=$(echo "${MATCH_REPO//\//\\\/}")

LC_ALL=C find $WORKING_DIR -type f -exec sed -i "" "s/$CONSTANT_TEAM_ID/$TEAM_ID/g" {} +
LC_ALL=C find $WORKING_DIR -type f -exec sed -i "" "s/$CONSTANT_STAGING_FIREBASE_APP_ID/$STAGING_FIREBASE_APP_ID/g" {} +
LC_ALL=C find $WORKING_DIR -type f -exec sed -i "" "s/$CONSTANT_FIREBASE_TESTER_GROUPS/nimble/g" {} +
LC_ALL=C find $WORKING_DIR -type f -exec sed -i "" "s/$CONSTANT_MATCH_REPO/$MATCH_REPO_ESCAPED/g" {} +

0 comments on commit ebcb4cc

Please sign in to comment.