diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml index 79503b8f4b09..69c2bf17c831 100644 --- a/.github/workflows/testBuild.yml +++ b/.github/workflows/testBuild.yml @@ -22,7 +22,7 @@ jobs: team: mobile-deployers android: - name: Build and deploy Android + name: Build and deploy Android for testing needs: validateActor if: ${{ fromJSON(needs.validateActor.outputs.IS_TEAM_MEMBER) }} runs-on: ubuntu-latest @@ -51,7 +51,7 @@ jobs: - name: Run Fastlane beta test id: runFastlaneBetaTest - run: bundle exec fastlane android build_test + run: bundle exec fastlane android build_internal env: S3_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY_ID }} S3_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} @@ -65,7 +65,7 @@ jobs: path: ./android_paths.json iOS: - name: Build and deploy iOS + name: Build and deploy iOS for testing needs: validateActor if: ${{ fromJSON(needs.validateActor.outputs.IS_TEAM_MEMBER) }} runs-on: macos-12 @@ -100,7 +100,7 @@ jobs: LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }} - name: Run Fastlane - run: bundle exec fastlane ios build_test + run: bundle exec fastlane ios build_internal env: S3_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY_ID }} S3_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} @@ -113,6 +113,34 @@ jobs: name: ios path: ./ios_paths.json + desktop: + name: Build and deploy Desktop for testing + needs: validateActor + if: ${{ fromJSON(needs.validateActor.outputs.IS_TEAM_MEMBER) }} + runs-on: macos-12 + steps: + # This action checks-out the repository, so the workflow can access it. + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + fetch-depth: 0 + + - uses: Expensify/App/.github/actions/composite/setupNode@main + + - name: Decrypt Developer ID Certificate + run: cd desktop && gpg --quiet --batch --yes --decrypt --passphrase="$DEVELOPER_ID_SECRET_PASSPHRASE" --output developer_id.p12 developer_id.p12.gpg + env: + DEVELOPER_ID_SECRET_PASSPHRASE: ${{ secrets.DEVELOPER_ID_SECRET_PASSPHRASE }} + + - name: Build desktop app for testing + run: npm run desktop-build-internal -- --publish always + env: + CSC_LINK: ${{ secrets.CSC_LINK }} + CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + # web: # name: Build and deploy Web # needs: validateActor diff --git a/android/app/build.gradle b/android/app/build.gradle index 08cbfe4527d7..851ea880d974 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -258,6 +258,11 @@ android { matchingFallbacks = ['release'] signingConfig signingConfigs.debug } + internalRelease { + initWith release + matchingFallbacks = ['release'] + signingConfig signingConfigs.debug + } } // applicationVariants are e.g. debug, release diff --git a/config/electronBuilder.config.js b/config/electronBuilder.config.js index 2c076e894032..6ffd9e3b2a8e 100644 --- a/config/electronBuilder.config.js +++ b/config/electronBuilder.config.js @@ -1,8 +1,23 @@ const {version} = require('../package.json'); -const isStaging = process.env.ELECTRON_ENV === 'staging'; const isPublishing = process.argv.includes('--publish'); +const s3Bucket = { + production: 'expensify-cash', + staging: 'staging-expensify-cash', + internal: 'ad-hoc-expensify-cash', +}; + +const macIcon = { + production: './desktop/icon.png', + staging: './desktop/icon-stg.png', + internal: './desktop/icon-stg.png', +}; + +const isCorrectElectronEnv = ['production', 'staging', 'internal'].includes( + process.env.ELECTRON_ENV, +); + /** * The configuration for the production and staging Electron builds. * It can be used to create local builds of the same, by omitting the `--publish` flag @@ -15,7 +30,9 @@ module.exports = { }, mac: { category: 'public.app-category.finance', - icon: isStaging ? './desktop/icon-stg.png' : './desktop/icon.png', + icon: isCorrectElectronEnv + ? macIcon[process.env.ELECTRON_ENV] + : './desktop/icon-stg.png', hardenedRuntime: true, entitlements: 'desktop/entitlements.mac.plist', entitlementsInherit: 'desktop/entitlements.mac.plist', @@ -26,16 +43,17 @@ module.exports = { artifactName: 'NewExpensify.dmg', internetEnabled: true, }, - publish: [{ - provider: 's3', - bucket: isStaging ? 'staging-expensify-cash' : 'expensify-cash', - channel: 'latest', - }], - afterSign: isPublishing ? './desktop/notarize.js' : undefined, - files: [ - 'dist', - '!dist/www/{.well-known,favicon*}', + publish: [ + { + provider: 's3', + bucket: isCorrectElectronEnv + ? s3Bucket[process.env.ELECTRON_ENV] + : 'ad-hoc-expensify-cash', + channel: 'latest', + }, ], + afterSign: isPublishing ? './desktop/notarize.js' : undefined, + files: ['dist', '!dist/www/{.well-known,favicon*}'], directories: { app: 'desktop', output: 'desktop-build', diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 4188e62db7be..141f59ab8149 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -37,13 +37,13 @@ platform :android do end desc "Build app for testing" - lane :build_test do + lane :build_internal do ENV["ENVFILE"]=".env.staging" gradle( project_dir: './android', task: 'assemble', - build_type: 'Release', + build_type: 'InternalRelease', ) aws_s3( @@ -115,7 +115,7 @@ platform :ios do end desc "Build app for testing" - lane :build_test do + lane :build_internal do require 'securerandom' ENV["ENVFILE"]=".env.staging" @@ -137,7 +137,7 @@ platform :ios do ) install_provisioning_profile( - path: "./ios/chat_expensify_adhoc.mobileprovision.gpg" + path: "./ios/chat_expensify_adhoc.mobileprovision" ) build_app( diff --git a/package.json b/package.json index fb2e1d98cf63..52e34aa1c06d 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "desktop": "scripts/set-pusher-suffix.sh && node desktop/start.js", "desktop-build": "scripts/build-desktop.sh production", "desktop-build-staging": "scripts/build-desktop.sh staging", + "desktop-build-internal": "scripts/build-desktop.sh internal", "ios-build": "fastlane ios build", "android-build": "fastlane android build", "android-build-e2e": "bundle exec fastlane android build_e2e", diff --git a/scripts/build-desktop.sh b/scripts/build-desktop.sh index 3e5024fc758c..ce8737ee1b18 100755 --- a/scripts/build-desktop.sh +++ b/scripts/build-desktop.sh @@ -5,6 +5,8 @@ export ELECTRON_ENV=${1:-development} if [[ "$ELECTRON_ENV" == "staging" ]]; then ENV_FILE=".env.staging" +elif [[ "$ELECTRON_ENV" == "internal" ]]; then + ENV_FILE=".env.staging" elif [[ "$ELECTRON_ENV" == "production" ]]; then ENV_FILE=".env.production" else