Skip to content

Commit

Permalink
Merge branch 'make-new-dot-signin-default-for-hybridapp' into war-in/…
Browse files Browse the repository at this point in the history
…add-google-apple-saml

# Conflicts:
#	src/libs/API/types.ts
  • Loading branch information
war-in committed Dec 5, 2024
2 parents 9d4186d + ddb9aef commit af530dc
Show file tree
Hide file tree
Showing 148 changed files with 2,040 additions and 898 deletions.
10 changes: 5 additions & 5 deletions .github/actions/javascript/postTestBuildComment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ description: "Mark pull requests as deployed on production or staging"
inputs:
PR_NUMBER:
description: "Pull request number"
required: true
required: false
GITHUB_TOKEN:
description: "Github token for authentication"
default: "${{ github.token }}"
ANDROID:
description: "Android job result ('success', 'failure', 'cancelled', or 'skipped')"
required: true
required: false
DESKTOP:
description: "Desktop job result ('success', 'failure', 'cancelled', or 'skipped')"
required: true
required: false
IOS:
description: "iOS job result ('success', 'failure', 'cancelled', or 'skipped')"
required: true
required: false
WEB:
description: "Web job result ('success', 'failure', 'cancelled', or 'skipped')"
required: true
required: false
ANDROID_LINK:
description: "Link for the Android build"
required: false
Expand Down
49 changes: 28 additions & 21 deletions .github/actions/javascript/postTestBuildComment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11502,31 +11502,38 @@ const github_1 = __nccwpck_require__(5438);
const CONST_1 = __importDefault(__nccwpck_require__(9873));
const GithubUtils_1 = __importDefault(__nccwpck_require__(9296));
function getTestBuildMessage() {
console.log('Input for android', core.getInput('ANDROID', { required: true }));
const androidSuccess = core.getInput('ANDROID', { required: true }) === 'success';
const desktopSuccess = core.getInput('DESKTOP', { required: true }) === 'success';
const iOSSuccess = core.getInput('IOS', { required: true }) === 'success';
const webSuccess = core.getInput('WEB', { required: true }) === 'success';
const androidLink = androidSuccess ? core.getInput('ANDROID_LINK') : '❌ FAILED ❌';
const desktopLink = desktopSuccess ? core.getInput('DESKTOP_LINK') : '❌ FAILED ❌';
const iOSLink = iOSSuccess ? core.getInput('IOS_LINK') : '❌ FAILED ❌';
const webLink = webSuccess ? core.getInput('WEB_LINK') : '❌ FAILED ❌';
const androidQRCode = androidSuccess
? `![Android](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${androidLink})`
: "The QR code can't be generated, because the android build failed";
const desktopQRCode = desktopSuccess
? `![Desktop](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${desktopLink})`
: "The QR code can't be generated, because the Desktop build failed";
const iOSQRCode = iOSSuccess ? `![iOS](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${iOSLink})` : "The QR code can't be generated, because the iOS build failed";
const webQRCode = webSuccess ? `![Web](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${webLink})` : "The QR code can't be generated, because the web build failed";
const inputs = ['ANDROID', 'DESKTOP', 'IOS', 'WEB'];
const names = {
[inputs[0]]: 'Android',
[inputs[1]]: 'Desktop',
[inputs[2]]: 'iOS',
[inputs[3]]: 'Web',
};
const result = inputs.reduce((acc, platform) => {
const input = core.getInput(platform, { required: false });
if (!input) {
acc[platform] = { link: 'N/A', qrCode: 'N/A' };
return acc;
}
const isSuccess = input === 'success';
const link = isSuccess ? core.getInput(`${platform}_LINK`) : '❌ FAILED ❌';
const qrCode = isSuccess
? `![${names[platform]}](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${link})`
: `The QR code can't be generated, because the ${names[platform]} build failed`;
acc[platform] = {
link,
qrCode,
};
return acc;
}, {});
const message = `:test_tube::test_tube: Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! :test_tube::test_tube:
| Android :robot: | iOS :apple: |
| ------------- | ------------- |
| ${androidLink} | ${iOSLink} |
| ${androidQRCode} | ${iOSQRCode} |
| ${result.ANDROID.link} | ${result.IOS.link} |
| ${result.ANDROID.qrCode} | ${result.IOS.qrCode} |
| Desktop :computer: | Web :spider_web: |
| ${desktopLink} | ${webLink} |
| ${desktopQRCode} | ${webQRCode} |
| ${result.DESKTOP.link} | ${result.WEB.link} |
| ${result.DESKTOP.qrCode} | ${result.WEB.qrCode} |

---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,48 @@
import * as core from '@actions/core';
import {context} from '@actions/github';
import type {TupleToUnion} from 'type-fest';
import CONST from '@github/libs/CONST';
import GithubUtils from '@github/libs/GithubUtils';

function getTestBuildMessage(): string {
console.log('Input for android', core.getInput('ANDROID', {required: true}));
const androidSuccess = core.getInput('ANDROID', {required: true}) === 'success';
const desktopSuccess = core.getInput('DESKTOP', {required: true}) === 'success';
const iOSSuccess = core.getInput('IOS', {required: true}) === 'success';
const webSuccess = core.getInput('WEB', {required: true}) === 'success';
const inputs = ['ANDROID', 'DESKTOP', 'IOS', 'WEB'] as const;
const names = {
[inputs[0]]: 'Android',
[inputs[1]]: 'Desktop',
[inputs[2]]: 'iOS',
[inputs[3]]: 'Web',
};

const androidLink = androidSuccess ? core.getInput('ANDROID_LINK') : '❌ FAILED ❌';
const desktopLink = desktopSuccess ? core.getInput('DESKTOP_LINK') : '❌ FAILED ❌';
const iOSLink = iOSSuccess ? core.getInput('IOS_LINK') : '❌ FAILED ❌';
const webLink = webSuccess ? core.getInput('WEB_LINK') : '❌ FAILED ❌';
const result = inputs.reduce((acc, platform) => {
const input = core.getInput(platform, {required: false});

const androidQRCode = androidSuccess
? `![Android](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${androidLink})`
: "The QR code can't be generated, because the android build failed";
const desktopQRCode = desktopSuccess
? `![Desktop](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${desktopLink})`
: "The QR code can't be generated, because the Desktop build failed";
const iOSQRCode = iOSSuccess ? `![iOS](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${iOSLink})` : "The QR code can't be generated, because the iOS build failed";
const webQRCode = webSuccess ? `![Web](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${webLink})` : "The QR code can't be generated, because the web build failed";
if (!input) {
acc[platform] = {link: 'N/A', qrCode: 'N/A'};
return acc;
}

const isSuccess = input === 'success';

const link = isSuccess ? core.getInput(`${platform}_LINK`) : '❌ FAILED ❌';
const qrCode = isSuccess
? `![${names[platform]}](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${link})`
: `The QR code can't be generated, because the ${names[platform]} build failed`;

acc[platform] = {
link,
qrCode,
};
return acc;
}, {} as Record<TupleToUnion<typeof inputs>, {link: string; qrCode: string}>);

const message = `:test_tube::test_tube: Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! :test_tube::test_tube:
| Android :robot: | iOS :apple: |
| ------------- | ------------- |
| ${androidLink} | ${iOSLink} |
| ${androidQRCode} | ${iOSQRCode} |
| ${result.ANDROID.link} | ${result.IOS.link} |
| ${result.ANDROID.qrCode} | ${result.IOS.qrCode} |
| Desktop :computer: | Web :spider_web: |
| ${desktopLink} | ${webLink} |
| ${desktopQRCode} | ${webQRCode} |
| ${result.DESKTOP.link} | ${result.WEB.link} |
| ${result.DESKTOP.qrCode} | ${result.WEB.qrCode} |
---
Expand Down
82 changes: 73 additions & 9 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,51 @@ jobs:
env:
BROWSERSTACK: ${{ secrets.BROWSERSTACK }}

submitAndroid:
name: Submit Android app for production review
needs: prep
if: ${{ github.ref == 'refs/heads/production' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Ruby
uses: ruby/[email protected]
with:
bundler-cache: true

- name: Get Android native version
id: getAndroidVersion
run: echo "VERSION_CODE=$(grep -o 'versionCode\s\+[0-9]\+' android/app/build.gradle | awk '{ print $2 }')" >> "$GITHUB_OUTPUT"

- name: Decrypt json w/ Google Play credentials
run: gpg --batch --yes --decrypt --passphrase="${{ secrets.LARGE_SECRET_PASSPHRASE }}" --output android-fastlane-json-key.json android-fastlane-json-key.json.gpg
working-directory: android/app

- name: Submit Android build for review
run: bundle exec fastlane android upload_google_play_production
env:
VERSION: ${{ steps.getAndroidVersion.outputs.VERSION_CODE }}

- name: Warn deployers if Android production deploy failed
if: ${{ failure() }}
uses: 8398a7/action-slack@v3
with:
status: custom
custom_payload: |
{
channel: '#deployer',
attachments: [{
color: "#DB4545",
pretext: `<!subteam^S4TJJ3PSL>`,
text: `💥 Android production deploy failed. Please manually submit ${{ needs.prep.outputs.APP_VERSION }} in the <https://play.google.com/console/u/0/developers/8765590895836334604/app/4973041797096886180/releases/overview|Google Play Store>. 💥`,
}]
}
env:
GITHUB_TOKEN: ${{ github.token }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

android_hybrid:
name: Build and deploy Android HybridApp
needs: prep
Expand Down Expand Up @@ -386,6 +431,12 @@ jobs:
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
if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
run: curl -u "$BROWSERSTACK" -X POST "https://api-cloud.browserstack.com/app-live/upload" -F "file=@/Users/runner/work/App/App/New Expensify.ipa"
Expand Down Expand Up @@ -503,6 +554,7 @@ jobs:
run: |
op document get --output ./OldApp_AppStore.mobileprovision OldApp_AppStore
op document get --output ./OldApp_AppStore_Share_Extension.mobileprovision OldApp_AppStore_Share_Extension
op document get --output ./OldApp_AppStore_Notification_Service.mobileprovision OldApp_AppStore_Notification_Service
- name: Decrypt AppStore profile
run: cd ios && gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" --output NewApp_AppStore.mobileprovision NewApp_AppStore.mobileprovision.gpg
Expand Down Expand Up @@ -679,7 +731,7 @@ jobs:
name: Post a Slack message when any platform fails to build or deploy
runs-on: ubuntu-latest
if: ${{ failure() }}
needs: [buildAndroid, uploadAndroid, android_hybrid, desktop, iOS, iOS_hybrid, web]
needs: [buildAndroid, uploadAndroid, submitAndroid, android_hybrid, desktop, iOS, iOS_hybrid, web]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -694,15 +746,21 @@ jobs:
outputs:
IS_AT_LEAST_ONE_PLATFORM_DEPLOYED: ${{ steps.checkDeploymentSuccessOnAtLeastOnePlatform.outputs.IS_AT_LEAST_ONE_PLATFORM_DEPLOYED }}
IS_ALL_PLATFORMS_DEPLOYED: ${{ steps.checkDeploymentSuccessOnAllPlatforms.outputs.IS_ALL_PLATFORMS_DEPLOYED }}
needs: [buildAndroid, uploadAndroid, android_hybrid, desktop, iOS, iOS_hybrid, web]
needs: [buildAndroid, uploadAndroid, submitAndroid, android_hybrid, desktop, iOS, iOS_hybrid, web]
if: ${{ always() }}
steps:
- name: Check deployment success on at least one platform
id: checkDeploymentSuccessOnAtLeastOnePlatform
run: |
isAtLeastOnePlatformDeployed="false"
if [ "${{ needs.uploadAndroid.result }}" == "success" ]; then
isAtLeastOnePlatformDeployed="true"
if [ ${{ github.ref }} == 'refs/heads/production' ]; then
if [ "${{ needs.submitAndroid.result }}" == "success" ]; then
isAtLeastOnePlatformDeployed="true"
fi
else
if [ "${{ needs.uploadAndroid.result }}" == "success" ]; then
isAtLeastOnePlatformDeployed="true"
fi
fi
if [ "${{ needs.iOS.result }}" == "success" ] || \
Expand All @@ -727,8 +785,14 @@ jobs:
isAllPlatformsDeployed="true"
fi
if [ "${{ needs.uploadAndroid.result }}" != "success" ]; then
isAllPlatformsDeployed="false"
if [ ${{ github.ref }} == 'refs/heads/production' ]; then
if [ "${{ needs.submitAndroid.result }}" != "success" ]; then
isAllPlatformsDeployed="false"
fi
else
if [ "${{ needs.uploadAndroid.result }}" != "success" ]; then
isAllPlatformsDeployed="false"
fi
fi
echo "IS_ALL_PLATFORMS_DEPLOYED=$isAllPlatformsDeployed" >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -876,7 +940,7 @@ jobs:
name: Post a Slack message when all platforms deploy successfully
runs-on: ubuntu-latest
if: ${{ always() && fromJSON(needs.checkDeploymentSuccess.outputs.IS_ALL_PLATFORMS_DEPLOYED) }}
needs: [prep, buildAndroid, uploadAndroid, android_hybrid, desktop, iOS, iOS_hybrid, web, checkDeploymentSuccess, createPrerelease, finalizeRelease]
needs: [prep, buildAndroid, uploadAndroid, submitAndroid, android_hybrid, desktop, iOS, iOS_hybrid, web, checkDeploymentSuccess, createPrerelease, finalizeRelease]
steps:
- name: 'Announces the deploy in the #announce Slack room'
uses: 8398a7/action-slack@v3
Expand Down Expand Up @@ -930,11 +994,11 @@ jobs:
postGithubComments:
uses: ./.github/workflows/postDeployComments.yml
if: ${{ always() && fromJSON(needs.checkDeploymentSuccess.outputs.IS_AT_LEAST_ONE_PLATFORM_DEPLOYED) }}
needs: [prep, buildAndroid, uploadAndroid, android_hybrid, desktop, iOS, iOS_hybrid, web, checkDeploymentSuccess, createPrerelease, finalizeRelease]
needs: [prep, buildAndroid, uploadAndroid, submitAndroid, android_hybrid, desktop, iOS, iOS_hybrid, web, checkDeploymentSuccess, createPrerelease, finalizeRelease]
with:
version: ${{ needs.prep.outputs.APP_VERSION }}
env: ${{ github.ref == 'refs/heads/production' && 'production' || 'staging' }}
android: ${{ github.ref == 'refs/heads/production' && needs.uploadAndroid.result }}
android: ${{ github.ref == 'refs/heads/production' && needs.submitAndroid.result || needs.uploadAndroid.result }}
android_hybrid: ${{ needs.android_hybrid.result }}
ios: ${{ needs.iOS.result }}
ios_hybrid: ${{ needs.iOS_hybrid.result }}
Expand Down
Loading

0 comments on commit af530dc

Please sign in to comment.