These files are provided as a supplement to the article "Bitrise and React Native"
Last active
October 17, 2022 15:26
-
-
Save lafiosca/d27ba3a242818d41d86d37586cc5abbc to your computer and use it in GitHub Desktop.
Bitrise and React Native
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
format_version: '8' | |
default_step_lib_source: 'https://github.com/bitrise-io/bitrise-steplib.git' | |
project_type: react-native | |
trigger_map: | |
- push_branch: dev | |
workflow: dev-deploy | |
- push_branch: prod | |
workflow: prod-deploy | |
- push_branch: dev-ios-only | |
workflow: dev-deploy-ios-only | |
- push_branch: prod-android-only | |
workflow: prod-deploy-android-only | |
- push_branch: prod-ios-only | |
workflow: prod-deploy-ios-only | |
workflows: | |
dev-deploy: | |
description: >- | |
Builds dev app (com.lafiosca.example.dev) for iOS and Android, deploys to users | |
for ad-hoc testing | |
steps: | |
- [email protected]: | |
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' | |
- [email protected]: {} | |
- [email protected]: | |
title: Prepare environment config | |
inputs: | |
- content: | | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -ex | |
ENV_FILE=env.$DEPLOY_ENV.ts | |
echo "Using config $ENV_FILE" | |
cp src/config/environments/env.$DEPLOY_ENV.ts src/config/env.ts | |
- [email protected]: | |
inputs: | |
- is_debug_mode: 'true' | |
- [email protected]: {} | |
- [email protected]: | |
title: Create npmrc | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
if [[ ! -f ~/.npmrc ]] | |
then | |
echo "Writing user .npmrc" | |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc | |
else | |
echo "User .npmrc already exists, not writing" | |
fi | |
- [email protected]: | |
title: Run yarn (install dependencies) | |
- [email protected]: | |
inputs: | |
- gradlew_path: $ANDROID_GRADLEW_PATH | |
- [email protected]: | |
title: Jetify | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
npx jetify | |
- [email protected]: | |
title: Configure Android project environment | |
inputs: | |
- content: > | |
#!/usr/bin/env bash | |
set -ex | |
set -o pipefail | |
echo "Replacing applicationId in $ANDROID_BUILD_GRADLE_PATH with | |
$APP_IDENTIFIER" | |
sed -i '' "s/\(applicationId \"\)[^\"]*\(\"\)/\1$APP_IDENTIFIER\2/" | |
"$ANDROID_BUILD_GRADLE_PATH" | |
MANIFEST_PLACEHOLDERS="[deeplinkUrlScheme: | |
\"${DEEPLINK_URL_SCHEME}\"]" | |
echo "Replacing manifestPlaceholders in $ANDROID_BUILD_GRADLE_PATH | |
with $MANIFEST_PLACEHOLDERS" | |
sed -i '' "s/\(manifestPlaceholders = | |
\)\[[^]]*\]/\1$MANIFEST_PLACEHOLDERS/" "$ANDROID_BUILD_GRADLE_PATH" | |
- [email protected]: | |
inputs: | |
- build_gradle_path: $ANDROID_BUILD_GRADLE_PATH | |
- new_version_name: $NPM_PACKAGE_VERSION | |
title: Set Android version | |
- [email protected]: | |
inputs: | |
- content: >- | |
#!/bin/bash | |
# fail if any commands fails | |
set -e | |
# Exits if missing values | |
if [ -z "${IOS_XCODEPROJ_PATH}" ]; then | |
echo "iOS project path not defined" | |
exit 1 | |
fi | |
if [ -z "${APP_IDENTIFIER}" ]; then | |
echo "App identifier not defined" | |
exit 1 | |
fi | |
if [ -z "${BITRISE_BUILD_NUMBER}" ]; then | |
echo "Bitrise build number not defined" | |
exit 1 | |
fi | |
if [ -z "${NPM_PACKAGE_VERSION}" ]; then | |
echo "NPM package version not defined" | |
exit 1 | |
fi | |
if [ -z "${MATCH_DISTRIBUTION_TYPE}" ]; then | |
echo "Match distribution type not defined" | |
exit 1 | |
fi | |
if [ -z "${DEEPLINK_URL_SCHEME}" ]; then | |
echo "Deeplink URL scheme not defined" | |
exit 1 | |
fi | |
# Exits if project file does not exists | |
PBXPROJ_FILE="${IOS_XCODEPROJ_PATH}/project.pbxproj" | |
if [ ! -f $PBXPROJ_FILE ]; then | |
echo "iOS project file ${PBXPROJ_FILE} not found" | |
exit 1 | |
fi | |
echo "Modifying iOS project file ${PBXPROJ_FILE}" | |
echo "" | |
echo "Replacing all PARENT_APP_BUNDLE_IDENTIFIER values with | |
${APP_IDENTIFIER}" | |
sed -i '' "s/\(PARENT_APP_BUNDLE_IDENTIFIER = | |
\).*\(;\)/\1${APP_IDENTIFIER}\2/" "$PBXPROJ_FILE" | |
echo "" | |
echo "Replacing all PARENT_APP_BUNDLE_VERSION values with | |
${BITRISE_BUILD_NUMBER}" | |
sed -i '' "s/\(PARENT_APP_BUNDLE_VERSION = | |
\).*\(;\)/\1${BITRISE_BUILD_NUMBER}\2/" "$PBXPROJ_FILE" | |
echo "" | |
echo "Replacing all PARENT_APP_BUNDLE_SHORT_VERSION values with | |
${NPM_PACKAGE_VERSION}" | |
sed -i '' "s/\(PARENT_APP_BUNDLE_SHORT_VERSION = | |
\).*\(;\)/\1${NPM_PACKAGE_VERSION}\2/" "$PBXPROJ_FILE" | |
echo "" | |
echo "Replacing all MATCH_DISTRIBUTION_TYPE values with | |
${MATCH_DISTRIBUTION_TYPE}" | |
sed -i '' "s/\(MATCH_DISTRIBUTION_TYPE = | |
\).*\(;\)/\1${MATCH_DISTRIBUTION_TYPE}\2/" "$PBXPROJ_FILE" | |
echo "" | |
echo "Replacing all DEEPLINK_URL_SCHEME values with | |
${DEEPLINK_URL_SCHEME}" | |
sed -i '' "s/\(DEEPLINK_URL_SCHEME = | |
\).*\(;\)/\1${DEEPLINK_URL_SCHEME}\2/" "$PBXPROJ_FILE" | |
echo "" | |
echo "Done!" | |
title: Configure iOS project environment | |
- [email protected]: | |
inputs: | |
- stamp_version: $NPM_PACKAGE_VERSION | |
- stamp_path_to_icons: $IOS_APPICON_PATH | |
title: Stamp iOS AppIcon with version number | |
- [email protected]: | |
inputs: | |
- variant: release | |
- project_location: $ANDROID_PATH | |
- [email protected]: | |
inputs: | |
- android_app: $BITRISE_APK_PATH | |
- [email protected]: | |
inputs: | |
- appcenter_org: $APPCENTER_ORG_NAME | |
- artifact_path: $BITRISE_SIGNED_APK_PATH | |
- appcenter_name: $APPCENTER_APP_NAME_ANDROID | |
title: AppCenter App Release (Android) | |
- [email protected]: {} | |
- [email protected]: | |
inputs: | |
- podfile_path: $IOS_PODFILE_PATH | |
- [email protected]: | |
inputs: | |
- project_path: $IOS_XCWORKSPACE_PATH | |
- scheme: $IOS_SCHEME | |
- export_method: $BITRISE_EXPORT_METHOD | |
- force_team_id: '' | |
- force_code_sign_identity: '' | |
- force_provisioning_profile_specifier: '' | |
- force_provisioning_profile: '' | |
- configuration: Release | |
- [email protected]: | |
inputs: | |
- appcenter_org: $APPCENTER_ORG_NAME | |
- artifact_path: $BITRISE_IPA_PATH | |
- appcenter_name: $APPCENTER_APP_NAME_IOS | |
title: AppCenter App Release (iOS) | |
- [email protected]: | |
inputs: | |
- app_id: $APPCENTER_ORG_NAME/$APPCENTER_APP_NAME_IOS | |
- api_token: $APPCENTER_API_TOKEN | |
- [email protected]: | |
inputs: | |
- tag: builds/$DEPLOY_ENV/$BITRISE_BUILD_NUMBER | |
- [email protected]: | |
inputs: | |
- is_debug_mode: 'true' | |
- cache_paths: |- | |
$IOS_PODS_PATH -> $IOS_PODFILE_LOCK_PATH | |
node_modules | |
- [email protected]: {} | |
envs: | |
- opts: | |
is_expand: false | |
APP_IDENTIFIER: com.lafiosca.example.dev | |
- opts: | |
is_expand: false | |
DEEPLINK_URL_SCHEME: lafioscadev | |
- opts: | |
is_expand: false | |
MATCH_DISTRIBUTION_TYPE: AdHoc | |
- opts: | |
is_expand: false | |
BITRISE_EXPORT_METHOD: ad-hoc | |
- opts: | |
is_expand: false | |
DEPLOY_ENV: dev | |
prod-deploy: | |
description: >- | |
Builds prod app (com.lafiosca.example) for iOS and Android, deploys to Test | |
Flight and Play Store | |
steps: | |
- [email protected]: | |
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' | |
- [email protected]: {} | |
- [email protected]: | |
title: Prepare environment config | |
inputs: | |
- content: | | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -ex | |
ENV_FILE=env.$DEPLOY_ENV.ts | |
echo "Using config $ENV_FILE" | |
cp src/config/environments/env.$DEPLOY_ENV.ts src/config/env.ts | |
- [email protected]: {} | |
- [email protected]: {} | |
- [email protected]: | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
if [[ ! -f ~/.npmrc ]] | |
then | |
echo "Writing user .npmrc" | |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc | |
else | |
echo "User .npmrc already exists, not writing" | |
fi | |
title: Create npmrc | |
- [email protected]: | |
title: Run yarn (install dependencies) | |
- [email protected]: | |
inputs: | |
- gradlew_path: $ANDROID_GRADLEW_PATH | |
- [email protected]: | |
title: Jetify | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
npx jetify | |
- [email protected]: | |
title: Configure Android project environment | |
inputs: | |
- content: > | |
#!/usr/bin/env bash | |
set -ex | |
set -o pipefail | |
GRADLE_BAK="$ANDROID_BUILD_GRADLE_PATH.bak" | |
echo "Replacing applicationId in $ANDROID_BUILD_GRADLE_PATH with | |
$APP_IDENTIFIER" | |
sed -i '' "s/\(applicationId \"\)[^\"]*\(\"\)/\1$APP_IDENTIFIER\2/" | |
"$ANDROID_BUILD_GRADLE_PATH" | |
MANIFEST_PLACEHOLDERS="[deeplinkUrlScheme: | |
\"${DEEPLINK_URL_SCHEME}\"]" | |
echo "Replacing manifestPlaceholders in $ANDROID_BUILD_GRADLE_PATH | |
with $MANIFEST_PLACEHOLDERS" | |
sed -i '' "s/\(manifestPlaceholders = | |
\)\[[^]]*\]/\1$MANIFEST_PLACEHOLDERS/" "$ANDROID_BUILD_GRADLE_PATH" | |
- [email protected]: | |
inputs: | |
- build_gradle_path: $ANDROID_BUILD_GRADLE_PATH | |
- new_version_name: $NPM_PACKAGE_VERSION | |
title: Set Android version | |
- [email protected]: | |
inputs: | |
- content: >- | |
#!/bin/bash | |
# fail if any commands fails | |
set -e | |
# Exits if missing values | |
if [ -z "${IOS_XCODEPROJ_PATH}" ]; then | |
echo "iOS project path not defined" | |
exit 1 | |
fi | |
if [ -z "${APP_IDENTIFIER}" ]; then | |
echo "App identifier not defined" | |
exit 1 | |
fi | |
if [ -z "${BITRISE_BUILD_NUMBER}" ]; then | |
echo "Bitrise build number not defined" | |
exit 1 | |
fi | |
if [ -z "${NPM_PACKAGE_VERSION}" ]; then | |
echo "NPM package version not defined" | |
exit 1 | |
fi | |
if [ -z "${MATCH_DISTRIBUTION_TYPE}" ]; then | |
echo "Match distribution type not defined" | |
exit 1 | |
fi | |
if [ -z "${DEEPLINK_URL_SCHEME}" ]; then | |
echo "Deeplink URL scheme not defined" | |
exit 1 | |
fi | |
# Exits if project file does not exists | |
PBXPROJ_FILE="${IOS_XCODEPROJ_PATH}/project.pbxproj" | |
if [ ! -f $PBXPROJ_FILE ]; then | |
echo "iOS project file ${PBXPROJ_FILE} not found" | |
exit 1 | |
fi | |
echo "Modifying iOS project file ${PBXPROJ_FILE}" | |
echo "" | |
echo "Replacing all PARENT_APP_BUNDLE_IDENTIFIER values with | |
${APP_IDENTIFIER}" | |
sed -i '' "s/\(PARENT_APP_BUNDLE_IDENTIFIER = | |
\).*\(;\)/\1${APP_IDENTIFIER}\2/" "$PBXPROJ_FILE" | |
echo "" | |
echo "Replacing all PARENT_APP_BUNDLE_VERSION values with | |
${BITRISE_BUILD_NUMBER}" | |
sed -i '' "s/\(PARENT_APP_BUNDLE_VERSION = | |
\).*\(;\)/\1${BITRISE_BUILD_NUMBER}\2/" "$PBXPROJ_FILE" | |
echo "" | |
echo "Replacing all PARENT_APP_BUNDLE_SHORT_VERSION values with | |
${NPM_PACKAGE_VERSION}" | |
sed -i '' "s/\(PARENT_APP_BUNDLE_SHORT_VERSION = | |
\).*\(;\)/\1${NPM_PACKAGE_VERSION}\2/" "$PBXPROJ_FILE" | |
echo "" | |
echo "Replacing all MATCH_DISTRIBUTION_TYPE values with | |
${MATCH_DISTRIBUTION_TYPE}" | |
sed -i '' "s/\(MATCH_DISTRIBUTION_TYPE = | |
\).*\(;\)/\1${MATCH_DISTRIBUTION_TYPE}\2/" "$PBXPROJ_FILE" | |
echo "" | |
echo "Replacing all DEEPLINK_URL_SCHEME values with | |
${DEEPLINK_URL_SCHEME}" | |
sed -i '' "s/\(DEEPLINK_URL_SCHEME = | |
\).*\(;\)/\1${DEEPLINK_URL_SCHEME}\2/" "$PBXPROJ_FILE" | |
echo "" | |
echo "Done!" | |
title: Configure iOS project environment | |
- [email protected]: | |
inputs: | |
- variant: release | |
- build_type: aab | |
- project_location: $ANDROID_PATH | |
- [email protected]: | |
inputs: | |
- android_app: $BITRISE_AAB_PATH | |
- [email protected]: | |
inputs: | |
- service_account_json_key_path: $BITRISEIO_GOOGLE_SERVICES_KEY_URL | |
- package_name: $APP_IDENTIFIER | |
- track: internal | |
- app_path: $BITRISE_SIGNED_AAB_PATH | |
- [email protected]: {} | |
- [email protected]: | |
inputs: | |
- podfile_path: $IOS_PODFILE_PATH | |
- [email protected]: | |
inputs: | |
- project_path: $IOS_XCWORKSPACE_PATH | |
- scheme: $IOS_SCHEME | |
- export_method: $BITRISE_EXPORT_METHOD | |
- force_team_id: '' | |
- force_code_sign_identity: '' | |
- force_provisioning_profile_specifier: '' | |
- force_provisioning_profile: '' | |
- configuration: Release | |
- [email protected]: | |
inputs: | |
- itunescon_user: $APPLE_ID | |
- app_password: $APPLE_PASSWORD | |
- pkg_path: '' | |
- [email protected]: | |
inputs: | |
- app_id: $APPCENTER_ORG_NAME/$APPCENTER_APP_NAME_IOS | |
- api_token: $APPCENTER_API_TOKEN | |
- [email protected]: | |
inputs: | |
- tag: builds/$DEPLOY_ENV/$BITRISE_BUILD_NUMBER | |
- [email protected]: | |
inputs: | |
- is_debug_mode: 'true' | |
- cache_paths: |- | |
$IOS_PODS_PATH -> $IOS_PODFILE_LOCK_PATH | |
node_modules | |
- [email protected]: {} | |
envs: | |
- opts: | |
is_expand: false | |
APP_IDENTIFIER: com.lafiosca.example | |
- opts: | |
is_expand: false | |
DEEPLINK_URL_SCHEME: lafiosca | |
- opts: | |
is_expand: false | |
MATCH_DISTRIBUTION_TYPE: AppStore | |
- opts: | |
is_expand: false | |
BITRISE_EXPORT_METHOD: app-store | |
- opts: | |
is_expand: false | |
DEPLOY_ENV: prod | |
dev-deploy-ios-only: | |
description: >- | |
Builds dev app (com.lafiosca.example.dev) for iOS only, deploys to users for | |
ad-hoc testing | |
steps: | |
- [email protected]: | |
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' | |
- [email protected]: {} | |
- [email protected]: | |
title: Prepare environment config | |
inputs: | |
- content: | | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -ex | |
ENV_FILE=env.$DEPLOY_ENV.ts | |
echo "Using config $ENV_FILE" | |
cp src/config/environments/env.$DEPLOY_ENV.ts src/config/env.ts | |
- [email protected]: | |
inputs: | |
- is_debug_mode: 'true' | |
- [email protected]: {} | |
- [email protected]: | |
title: Create npmrc | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
if [[ ! -f ~/.npmrc ]] | |
then | |
echo "Writing user .npmrc" | |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc | |
else | |
echo "User .npmrc already exists, not writing" | |
fi | |
- [email protected]: | |
title: Run yarn (install dependencies) | |
- [email protected]: | |
inputs: | |
- content: >- | |
#!/bin/bash | |
# fail if any commands fails | |
set -e | |
# Exits if missing values | |
if [ -z "${IOS_XCODEPROJ_PATH}" ]; then | |
echo "iOS project path not defined" | |
exit 1 | |
fi | |
if [ -z "${APP_IDENTIFIER}" ]; then | |
echo "App identifier not defined" | |
exit 1 | |
fi | |
if [ -z "${BITRISE_BUILD_NUMBER}" ]; then | |
echo "Bitrise build number not defined" | |
exit 1 | |
fi | |
if [ -z "${NPM_PACKAGE_VERSION}" ]; then | |
echo "NPM package version not defined" | |
exit 1 | |
fi | |
if [ -z "${MATCH_DISTRIBUTION_TYPE}" ]; then | |
echo "Match distribution type not defined" | |
exit 1 | |
fi | |
if [ -z "${DEEPLINK_URL_SCHEME}" ]; then | |
echo "Deeplink URL scheme not defined" | |
exit 1 | |
fi | |
# Exits if project file does not exists | |
PBXPROJ_FILE="${IOS_XCODEPROJ_PATH}/project.pbxproj" | |
if [ ! -f $PBXPROJ_FILE ]; then | |
echo "iOS project file ${PBXPROJ_FILE} not found" | |
exit 1 | |
fi | |
echo "Modifying iOS project file ${PBXPROJ_FILE}" | |
echo "" | |
echo "Replacing all PARENT_APP_BUNDLE_IDENTIFIER values with | |
${APP_IDENTIFIER}" | |
sed -i '' "s/\(PARENT_APP_BUNDLE_IDENTIFIER = | |
\).*\(;\)/\1${APP_IDENTIFIER}\2/" "$PBXPROJ_FILE" | |
echo "" | |
echo "Replacing all PARENT_APP_BUNDLE_VERSION values with | |
${BITRISE_BUILD_NUMBER}" | |
sed -i '' "s/\(PARENT_APP_BUNDLE_VERSION = | |
\).*\(;\)/\1${BITRISE_BUILD_NUMBER}\2/" "$PBXPROJ_FILE" | |
echo "" | |
echo "Replacing all PARENT_APP_BUNDLE_SHORT_VERSION values with | |
${NPM_PACKAGE_VERSION}" | |
sed -i '' "s/\(PARENT_APP_BUNDLE_SHORT_VERSION = | |
\).*\(;\)/\1${NPM_PACKAGE_VERSION}\2/" "$PBXPROJ_FILE" | |
echo "" | |
echo "Replacing all MATCH_DISTRIBUTION_TYPE values with | |
${MATCH_DISTRIBUTION_TYPE}" | |
sed -i '' "s/\(MATCH_DISTRIBUTION_TYPE = | |
\).*\(;\)/\1${MATCH_DISTRIBUTION_TYPE}\2/" "$PBXPROJ_FILE" | |
echo "" | |
echo "Replacing all DEEPLINK_URL_SCHEME values with | |
${DEEPLINK_URL_SCHEME}" | |
sed -i '' "s/\(DEEPLINK_URL_SCHEME = | |
\).*\(;\)/\1${DEEPLINK_URL_SCHEME}\2/" "$PBXPROJ_FILE" | |
echo "" | |
echo "Done!" | |
title: Configure iOS project environment | |
- [email protected]: | |
inputs: | |
- stamp_version: $NPM_PACKAGE_VERSION | |
- stamp_path_to_icons: $IOS_APPICON_PATH | |
title: Stamp iOS AppIcon with version number | |
- [email protected]: {} | |
- [email protected]: | |
inputs: | |
- podfile_path: $IOS_PODFILE_PATH | |
- [email protected]: | |
inputs: | |
- project_path: $IOS_XCWORKSPACE_PATH | |
- scheme: $IOS_SCHEME | |
- export_method: $BITRISE_EXPORT_METHOD | |
- force_team_id: '' | |
- force_code_sign_identity: '' | |
- force_provisioning_profile_specifier: '' | |
- force_provisioning_profile: '' | |
- configuration: Release | |
- [email protected]: | |
inputs: | |
- appcenter_org: $APPCENTER_ORG_NAME | |
- artifact_path: $BITRISE_IPA_PATH | |
- appcenter_name: $APPCENTER_APP_NAME_IOS | |
title: AppCenter App Release (iOS) | |
- [email protected]: | |
inputs: | |
- app_id: $APPCENTER_ORG_NAME/$APPCENTER_APP_NAME_IOS | |
- api_token: $APPCENTER_API_TOKEN | |
- [email protected]: | |
inputs: | |
- tag: builds/$DEPLOY_ENV/$BITRISE_BUILD_NUMBER | |
- [email protected]: | |
inputs: | |
- is_debug_mode: 'true' | |
- cache_paths: |- | |
$IOS_PODS_PATH -> $IOS_PODFILE_LOCK_PATH | |
node_modules | |
- [email protected]: {} | |
envs: | |
- opts: | |
is_expand: false | |
APP_IDENTIFIER: com.lafiosca.example.dev | |
- opts: | |
is_expand: false | |
DEEPLINK_URL_SCHEME: lafioscadev | |
- opts: | |
is_expand: false | |
MATCH_DISTRIBUTION_TYPE: AdHoc | |
- opts: | |
is_expand: false | |
BITRISE_EXPORT_METHOD: ad-hoc | |
- opts: | |
is_expand: false | |
DEPLOY_ENV: dev | |
prod-deploy-android-only: | |
description: 'Builds prod app (com.lafiosca.example) for Android, deploys to Play Store' | |
steps: | |
- [email protected]: | |
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' | |
- [email protected]: {} | |
- [email protected]: | |
title: Prepare environment config | |
inputs: | |
- content: | | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -ex | |
ENV_FILE=env.$DEPLOY_ENV.ts | |
echo "Using config $ENV_FILE" | |
cp src/config/environments/env.$DEPLOY_ENV.ts src/config/env.ts | |
- [email protected]: {} | |
- [email protected]: {} | |
- [email protected]: | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
if [[ ! -f ~/.npmrc ]] | |
then | |
echo "Writing user .npmrc" | |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc | |
else | |
echo "User .npmrc already exists, not writing" | |
fi | |
title: Create npmrc | |
- [email protected]: | |
title: Run yarn (install dependencies) | |
- [email protected]: | |
inputs: | |
- gradlew_path: $ANDROID_GRADLEW_PATH | |
- [email protected]: | |
title: Jetify | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
npx jetify | |
- [email protected]: | |
title: Configure Android project environment | |
inputs: | |
- content: > | |
#!/usr/bin/env bash | |
set -ex | |
set -o pipefail | |
GRADLE_BAK="$ANDROID_BUILD_GRADLE_PATH.bak" | |
echo "Replacing applicationId in $ANDROID_BUILD_GRADLE_PATH with | |
$APP_IDENTIFIER" | |
sed -i '' "s/\(applicationId \"\)[^\"]*\(\"\)/\1$APP_IDENTIFIER\2/" | |
"$ANDROID_BUILD_GRADLE_PATH" | |
MANIFEST_PLACEHOLDERS="[deeplinkUrlScheme: | |
\"${DEEPLINK_URL_SCHEME}\"]" | |
echo "Replacing manifestPlaceholders in $ANDROID_BUILD_GRADLE_PATH | |
with $MANIFEST_PLACEHOLDERS" | |
sed -i '' "s/\(manifestPlaceholders = | |
\)\[[^]]*\]/\1$MANIFEST_PLACEHOLDERS/" "$ANDROID_BUILD_GRADLE_PATH" | |
- [email protected]: | |
inputs: | |
- build_gradle_path: $ANDROID_BUILD_GRADLE_PATH | |
- new_version_name: $NPM_PACKAGE_VERSION | |
title: Set Android version | |
- [email protected]: | |
inputs: | |
- variant: release | |
- build_type: aab | |
- project_location: $ANDROID_PATH | |
- [email protected]: | |
inputs: | |
- android_app: $BITRISE_AAB_PATH | |
- [email protected]: | |
inputs: | |
- service_account_json_key_path: $BITRISEIO_GOOGLE_SERVICES_KEY_URL | |
- package_name: $APP_IDENTIFIER | |
- track: internal | |
- app_path: $BITRISE_SIGNED_AAB_PATH | |
- [email protected]: | |
inputs: | |
- tag: builds/$DEPLOY_ENV/$BITRISE_BUILD_NUMBER | |
- [email protected]: | |
inputs: | |
- is_debug_mode: 'true' | |
- cache_paths: |- | |
$IOS_PODS_PATH -> $IOS_PODFILE_LOCK_PATH | |
node_modules | |
- [email protected]: {} | |
envs: | |
- opts: | |
is_expand: false | |
APP_IDENTIFIER: com.lafiosca.example | |
- opts: | |
is_expand: false | |
DEEPLINK_URL_SCHEME: lafiosca | |
- opts: | |
is_expand: false | |
DEPLOY_ENV: prod | |
prod-deploy-ios-only: | |
description: 'Builds prod app (com.lafiosca.example) for iOS, deploys to Test Flight' | |
steps: | |
- [email protected]: | |
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' | |
- [email protected]: {} | |
- [email protected]: | |
title: Prepare environment config | |
inputs: | |
- content: | | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -ex | |
ENV_FILE=env.$DEPLOY_ENV.ts | |
echo "Using config $ENV_FILE" | |
cp src/config/environments/env.$DEPLOY_ENV.ts src/config/env.ts | |
- [email protected]: {} | |
- [email protected]: {} | |
- [email protected]: | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
if [[ ! -f ~/.npmrc ]] | |
then | |
echo "Writing user .npmrc" | |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc | |
else | |
echo "User .npmrc already exists, not writing" | |
fi | |
title: Create npmrc | |
- [email protected]: | |
title: Run yarn (install dependencies) | |
- [email protected]: | |
inputs: | |
- content: >- | |
#!/bin/bash | |
# fail if any commands fails | |
set -e | |
# Exits if missing values | |
if [ -z "${IOS_XCODEPROJ_PATH}" ]; then | |
echo "iOS project path not defined" | |
exit 1 | |
fi | |
if [ -z "${APP_IDENTIFIER}" ]; then | |
echo "App identifier not defined" | |
exit 1 | |
fi | |
if [ -z "${BITRISE_BUILD_NUMBER}" ]; then | |
echo "Bitrise build number not defined" | |
exit 1 | |
fi | |
if [ -z "${NPM_PACKAGE_VERSION}" ]; then | |
echo "NPM package version not defined" | |
exit 1 | |
fi | |
if [ -z "${MATCH_DISTRIBUTION_TYPE}" ]; then | |
echo "Match distribution type not defined" | |
exit 1 | |
fi | |
if [ -z "${DEEPLINK_URL_SCHEME}" ]; then | |
echo "Deeplink URL scheme not defined" | |
exit 1 | |
fi | |
# Exits if project file does not exists | |
PBXPROJ_FILE="${IOS_XCODEPROJ_PATH}/project.pbxproj" | |
if [ ! -f $PBXPROJ_FILE ]; then | |
echo "iOS project file ${PBXPROJ_FILE} not found" | |
exit 1 | |
fi | |
echo "Modifying iOS project file ${PBXPROJ_FILE}" | |
echo "" | |
echo "Replacing all PARENT_APP_BUNDLE_IDENTIFIER values with | |
${APP_IDENTIFIER}" | |
sed -i '' "s/\(PARENT_APP_BUNDLE_IDENTIFIER = | |
\).*\(;\)/\1${APP_IDENTIFIER}\2/" "$PBXPROJ_FILE" | |
echo "" | |
echo "Replacing all PARENT_APP_BUNDLE_VERSION values with | |
${BITRISE_BUILD_NUMBER}" | |
sed -i '' "s/\(PARENT_APP_BUNDLE_VERSION = | |
\).*\(;\)/\1${BITRISE_BUILD_NUMBER}\2/" "$PBXPROJ_FILE" | |
echo "" | |
echo "Replacing all PARENT_APP_BUNDLE_SHORT_VERSION values with | |
${NPM_PACKAGE_VERSION}" | |
sed -i '' "s/\(PARENT_APP_BUNDLE_SHORT_VERSION = | |
\).*\(;\)/\1${NPM_PACKAGE_VERSION}\2/" "$PBXPROJ_FILE" | |
echo "" | |
echo "Replacing all MATCH_DISTRIBUTION_TYPE values with | |
${MATCH_DISTRIBUTION_TYPE}" | |
sed -i '' "s/\(MATCH_DISTRIBUTION_TYPE = | |
\).*\(;\)/\1${MATCH_DISTRIBUTION_TYPE}\2/" "$PBXPROJ_FILE" | |
echo "" | |
echo "Replacing all DEEPLINK_URL_SCHEME values with | |
${DEEPLINK_URL_SCHEME}" | |
sed -i '' "s/\(DEEPLINK_URL_SCHEME = | |
\).*\(;\)/\1${DEEPLINK_URL_SCHEME}\2/" "$PBXPROJ_FILE" | |
echo "" | |
echo "Done!" | |
title: Configure iOS project environment | |
- [email protected]: {} | |
- [email protected]: | |
inputs: | |
- podfile_path: $IOS_PODFILE_PATH | |
- [email protected]: | |
inputs: | |
- project_path: $IOS_XCWORKSPACE_PATH | |
- scheme: $IOS_SCHEME | |
- export_method: $BITRISE_EXPORT_METHOD | |
- force_team_id: '' | |
- force_code_sign_identity: '' | |
- force_provisioning_profile_specifier: '' | |
- force_provisioning_profile: '' | |
- configuration: Release | |
- [email protected]: | |
inputs: | |
- itunescon_user: $APPLE_ID | |
- app_password: $APPLE_PASSWORD | |
- pkg_path: '' | |
- [email protected]: | |
inputs: | |
- app_id: $APPCENTER_ORG_NAME/$APPCENTER_APP_NAME_IOS | |
- api_token: $APPCENTER_API_TOKEN | |
- [email protected]: | |
inputs: | |
- tag: builds/$DEPLOY_ENV/$BITRISE_BUILD_NUMBER | |
- [email protected]: | |
inputs: | |
- is_debug_mode: 'true' | |
- cache_paths: |- | |
$IOS_PODS_PATH -> $IOS_PODFILE_LOCK_PATH | |
node_modules | |
- [email protected]: {} | |
envs: | |
- opts: | |
is_expand: false | |
APP_IDENTIFIER: com.lafiosca.example | |
- opts: | |
is_expand: false | |
DEEPLINK_URL_SCHEME: lafiosca | |
- opts: | |
is_expand: false | |
MATCH_DISTRIBUTION_TYPE: AppStore | |
- opts: | |
is_expand: false | |
BITRISE_EXPORT_METHOD: app-store | |
- opts: | |
is_expand: false | |
DEPLOY_ENV: prod | |
app: | |
envs: | |
- opts: | |
is_expand: false | |
ANDROID_PATH: android | |
- ANDROID_GRADLEW_PATH: $ANDROID_PATH/gradlew | |
- ANDROID_APP_PATH: $ANDROID_PATH/app | |
- ANDROID_BUILD_GRADLE_PATH: $ANDROID_APP_PATH/build.gradle | |
- opts: | |
is_expand: false | |
IOS_PATH: ios | |
- opts: | |
is_expand: false | |
IOS_PROJECT_NAME: LafioscaExampleApp | |
- IOS_XCWORKSPACE_PATH: $IOS_PATH/$IOS_PROJECT_NAME.xcworkspace | |
- IOS_XCODEPROJ_PATH: $IOS_PATH/$IOS_PROJECT_NAME.xcodeproj | |
- IOS_PODFILE_PATH: $IOS_PATH/Podfile | |
- IOS_PODFILE_LOCK_PATH: $IOS_PATH/Podfile.lock | |
- IOS_PODS_PATH: $IOS_PATH/Pods | |
- IOS_APPICON_PATH: $IOS_PATH/$IOS_PROJECT_NAME/Images.xcassets/AppIcon.appiconset | |
- opts: | |
is_expand: false | |
IOS_SCHEME: LafioscaExampleApp | |
- opts: | |
is_expand: false | |
APPCENTER_ORG_NAME: nuclearpasta | |
- opts: | |
is_expand: false | |
APPCENTER_APP_NAME_IOS: lafiosca-example-app-ios | |
- opts: | |
is_expand: false | |
APPCENTER_APP_NAME_ANDROID: lafiosca-example-app-android | |
meta: | |
bitrise.io: | |
machine_type: elite_xl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>CFBundleDevelopmentRegion</key> | |
<string>en</string> | |
<key>CFBundleDisplayName</key> | |
<string>Lafiosca Example</string> | |
<key>CFBundleExecutable</key> | |
<string>$(EXECUTABLE_NAME)</string> | |
<key>CFBundleIcons</key> | |
<dict/> | |
<key>CFBundleIcons~ipad</key> | |
<dict/> | |
<key>CFBundleIdentifier</key> | |
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | |
<key>CFBundleInfoDictionaryVersion</key> | |
<string>6.0</string> | |
<key>CFBundleName</key> | |
<string>$(PRODUCT_NAME)</string> | |
<key>CFBundlePackageType</key> | |
<string>APPL</string> | |
<key>CFBundleShortVersionString</key> | |
<string>$(PARENT_APP_BUNDLE_SHORT_VERSION)</string> | |
<key>CFBundleSignature</key> | |
<string>????</string> | |
<key>CFBundleURLTypes</key> | |
<array> | |
<dict> | |
<key>CFBundleURLSchemes</key> | |
<array> | |
<string>$(DEEPLINK_URL_SCHEME)</string> | |
</array> | |
</dict> | |
</array> | |
<key>CFBundleVersion</key> | |
<string>$(PARENT_APP_BUNDLE_VERSION)</string> | |
<key>ITSAppUsesNonExemptEncryption</key> | |
<false/> | |
<key>LSRequiresIPhoneOS</key> | |
<true/> | |
<key>NSAppTransportSecurity</key> | |
<dict> | |
<key>NSAllowsArbitraryLoads</key> | |
<true/> | |
<key>NSExceptionDomains</key> | |
<dict> | |
<key>localhost</key> | |
<dict> | |
<key>NSExceptionAllowsInsecureHTTPLoads</key> | |
<true/> | |
</dict> | |
</dict> | |
</dict> | |
<key>NSCameraUsageDescription</key> | |
<string>Record media to attach to cards, comments, and profiles</string> | |
<key>NSLocationAlwaysUsageDescription</key> | |
<string>Recognize and notify when you are near work locations and spatial cards</string> | |
<key>NSLocationWhenInUseUsageDescription</key> | |
<string>Record locations for and recognize when you are near spatial cards</string> | |
<key>NSMicrophoneUsageDescription</key> | |
<string>Record media to attach to cards and comments</string> | |
<key>NSPhotoLibraryAddUsageDescription</key> | |
<string>Save media to camera roll when creating</string> | |
<key>NSPhotoLibraryUsageDescription</key> | |
<string>Attach media to cards, comments, and profiles</string> | |
<key>UIAppFonts</key> | |
<array> | |
<string>MaterialCommunityIcons.ttf</string> | |
<string>Roboto-Light.ttf</string> | |
<string>Roboto-Medium.ttf</string> | |
<string>Roboto-Regular.ttf</string> | |
<string>Roboto-Thin.ttf</string> | |
</array> | |
<key>UIBackgroundModes</key> | |
<array> | |
<string>remote-notification</string> | |
</array> | |
<key>UILaunchStoryboardName</key> | |
<string>LaunchScreen</string> | |
<key>UIRequiredDeviceCapabilities</key> | |
<array> | |
<string>armv7</string> | |
</array> | |
<key>UISupportedInterfaceOrientations</key> | |
<array> | |
<string>UIInterfaceOrientationPortrait</string> | |
</array> | |
<key>UIViewControllerBasedStatusBarAppearance</key> | |
<false/> | |
</dict> | |
</plist> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment