Skip to content

Commit

Permalink
fix ios and android config and add desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
staszekscp committed Nov 28, 2022
1 parent 8d8f8ac commit 8b499e3
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 19 deletions.
36 changes: 32 additions & 4 deletions .github/workflows/testBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
Expand All @@ -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
Expand Down Expand Up @@ -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 }}
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,11 @@ android {
matchingFallbacks = ['release']
signingConfig signingConfigs.debug
}
internalRelease {
initWith release
matchingFallbacks = ['release']
signingConfig signingConfigs.debug
}
}

// applicationVariants are e.g. debug, release
Expand Down
40 changes: 29 additions & 11 deletions config/electronBuilder.config.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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',
Expand All @@ -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',
Expand Down
8 changes: 4 additions & 4 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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"

Expand All @@ -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(
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions scripts/build-desktop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8b499e3

Please sign in to comment.