Skip to content

Commit

Permalink
Merge pull request #48754 from Expensify/Rory-SeparateBuildAndDeploy
Browse files Browse the repository at this point in the history
[No QA] Separate build and upload Fastlane lanes
  • Loading branch information
roryabraham authored Sep 9, 2024
2 parents 37749d3 + 3f02959 commit b90a6c6
Show file tree
Hide file tree
Showing 4 changed files with 203 additions and 157 deletions.
26 changes: 21 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ jobs:
name: Build and deploy Android
needs: prep
runs-on: ubuntu-latest-xl
env:
RUBYOPT: '-rostruct'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -106,12 +108,16 @@ jobs:
id: getAndroidVersion
run: echo "VERSION_CODE=$(grep -o 'versionCode\s\+[0-9]\+' android/app/build.gradle | awk '{ print $2 }')" >> "$GITHUB_OUTPUTS"

- name: Run Fastlane
run: bundle exec fastlane android ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) && 'production' || 'beta' }}
- name: Build Android app
if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: bundle exec fastlane android build
env:
RUBYOPT: '-rostruct'
MYAPP_UPLOAD_STORE_PASSWORD: ${{ secrets.MYAPP_UPLOAD_STORE_PASSWORD }}
MYAPP_UPLOAD_KEY_PASSWORD: ${{ secrets.MYAPP_UPLOAD_KEY_PASSWORD }}

- name: Upload Android app to Google Play
run: bundle exec fastlane android ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) && 'upload_google_play_production' || 'upload_google_play_internal' }}
env:
VERSION: ${{ steps.getAndroidVersion.outputs.VERSION_CODE }}

- name: Upload Android build to Browser Stack
Expand Down Expand Up @@ -269,13 +275,23 @@ jobs:
id: getIOSVersion
run: echo "IOS_VERSION=$(echo '${{ needs.prep.outputs.APP_VERSION }}' | tr '-' '.')" >> "$GITHUB_OUTPUTS"

- name: Run Fastlane
run: bundle exec fastlane ios ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) && 'production' || 'beta' }}
- name: Build iOS release app
if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: bundle exec fastlane ios build

- name: Upload release build to TestFlight
if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: bundle exec fastlane ios upload_testflight
env:
APPLE_CONTACT_EMAIL: ${{ secrets.APPLE_CONTACT_EMAIL }}
APPLE_CONTACT_PHONE: ${{ secrets.APPLE_CONTACT_PHONE }}
APPLE_DEMO_EMAIL: ${{ secrets.APPLE_DEMO_EMAIL }}
APPLE_DEMO_PASSWORD: ${{ secrets.APPLE_DEMO_PASSWORD }}

- name: Submit build for App Store review
if: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: bundle exec fastlane ios submit_for_review
env:
VERSION: ${{ steps.getIOSVersion.outputs.IOS_VERSION }}

- name: Upload iOS build to Browser Stack
Expand Down
34 changes: 17 additions & 17 deletions .github/workflows/testBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
types: [opened, synchronize, labeled]
branches: ['*ci-test/**']

env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}

jobs:
validateActor:
runs-on: ubuntu-latest
Expand All @@ -35,7 +38,6 @@ jobs:
echo "The 'Ready to Build' label is not attached to the PR #${{ env.PULL_REQUEST_NUMBER }}"
fi
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
GITHUB_TOKEN: ${{ github.token }}

getBranchRef:
Expand Down Expand Up @@ -64,7 +66,7 @@ jobs:
if: ${{ fromJSON(needs.validateActor.outputs.READY_TO_BUILD) }}
runs-on: ubuntu-latest-xl
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
RUBYOPT: '-rostruct'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -111,17 +113,19 @@ jobs:
- name: Configure MapBox SDK
run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}

- name: Run Fastlane beta test
id: runFastlaneBetaTest
run: bundle exec fastlane android build_internal
- name: Run AdHoc build
run: bundle exec fastlane android build_adhoc
env:
MYAPP_UPLOAD_STORE_PASSWORD: ${{ secrets.MYAPP_UPLOAD_STORE_PASSWORD }}
MYAPP_UPLOAD_KEY_PASSWORD: ${{ secrets.MYAPP_UPLOAD_KEY_PASSWORD }}

- name: Upload AdHoc build to S3
run: bundle exec fastlane android upload_s3
env:
RUBYOPT: '-rostruct'
S3_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY_ID }}
S3_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
S3_BUCKET: ad-hoc-expensify-cash
S3_REGION: us-east-1
MYAPP_UPLOAD_STORE_PASSWORD: ${{ secrets.MYAPP_UPLOAD_STORE_PASSWORD }}
MYAPP_UPLOAD_KEY_PASSWORD: ${{ secrets.MYAPP_UPLOAD_KEY_PASSWORD }}

- name: Upload Artifact
uses: actions/upload-artifact@v4
Expand All @@ -134,7 +138,6 @@ jobs:
needs: [validateActor, getBranchRef]
if: ${{ fromJSON(needs.validateActor.outputs.READY_TO_BUILD) }}
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
DEVELOPER_DIR: /Applications/Xcode_15.2.0.app/Contents/Developer
runs-on: macos-13-xlarge
steps:
Expand Down Expand Up @@ -205,8 +208,11 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Run Fastlane
run: bundle exec fastlane ios build_internal
- name: Build AdHoc app
run: bundle exec fastlane ios build_adhoc

- name: Upload AdHoc build to S3
run: bundle exec fastlane ios upload_s3
env:
S3_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY_ID }}
S3_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand All @@ -223,8 +229,6 @@ jobs:
name: Build and deploy Desktop for testing
needs: [validateActor, getBranchRef]
if: ${{ fromJSON(needs.validateActor.outputs.READY_TO_BUILD) }}
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
runs-on: macos-14-large
steps:
- name: Checkout
Expand Down Expand Up @@ -268,8 +272,6 @@ jobs:
name: Build and deploy Web
needs: [validateActor, getBranchRef]
if: ${{ fromJSON(needs.validateActor.outputs.READY_TO_BUILD) }}
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
runs-on: ubuntu-latest-xl
steps:
- name: Checkout
Expand Down Expand Up @@ -304,8 +306,6 @@ jobs:
name: Post a GitHub comment with app download links for testing
needs: [validateActor, getBranchRef, android, iOS, desktop, web]
if: ${{ always() }}
env:
PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
Loading

0 comments on commit b90a6c6

Please sign in to comment.