Skip to content

Instantly share code, notes, and snippets.

@lafiosca
Last active October 17, 2022 15:26
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lafiosca/d27ba3a242818d41d86d37586cc5abbc to your computer and use it in GitHub Desktop.
Save lafiosca/d27ba3a242818d41d86d37586cc5abbc to your computer and use it in GitHub Desktop.
Bitrise and React Native
---
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:
- activate-ssh-key@4.0:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@4.0: {}
- script@1.1:
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
- cache-pull@2.1:
inputs:
- is_debug_mode: 'true'
- get-npm-package-version@1.0: {}
- script@1.1:
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
- yarn@0.1:
title: Run yarn (install dependencies)
- install-missing-android-tools@2.3:
inputs:
- gradlew_path: $ANDROID_GRADLEW_PATH
- script@1.1:
title: Jetify
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
npx jetify
- script@1.1:
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"
- change-android-versioncode-and-versionname@1.2:
inputs:
- build_gradle_path: $ANDROID_BUILD_GRADLE_PATH
- new_version_name: $NPM_PACKAGE_VERSION
title: Set Android version
- script@1.1:
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
- bitrise-step-stamp-appicon-with-version-number@1.2:
inputs:
- stamp_version: $NPM_PACKAGE_VERSION
- stamp_path_to_icons: $IOS_APPICON_PATH
title: Stamp iOS AppIcon with version number
- android-build@0.10:
inputs:
- variant: release
- project_location: $ANDROID_PATH
- sign-apk@1.7:
inputs:
- android_app: $BITRISE_APK_PATH
- appcenter-app-release@1.0:
inputs:
- appcenter_org: $APPCENTER_ORG_NAME
- artifact_path: $BITRISE_SIGNED_APK_PATH
- appcenter_name: $APPCENTER_APP_NAME_ANDROID
title: AppCenter App Release (Android)
- certificate-and-profile-installer@1.10: {}
- cocoapods-install@1.11:
inputs:
- podfile_path: $IOS_PODFILE_PATH
- xcode-archive@2.8:
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
- appcenter-app-release@1.0:
inputs:
- appcenter_org: $APPCENTER_ORG_NAME
- artifact_path: $BITRISE_IPA_PATH
- appcenter_name: $APPCENTER_APP_NAME_IOS
title: AppCenter App Release (iOS)
- appcenter-dsym-upload@0.1:
inputs:
- app_id: $APPCENTER_ORG_NAME/$APPCENTER_APP_NAME_IOS
- api_token: $APPCENTER_API_TOKEN
- git-tag@1.1:
inputs:
- tag: builds/$DEPLOY_ENV/$BITRISE_BUILD_NUMBER
- cache-push@2.3:
inputs:
- is_debug_mode: 'true'
- cache_paths: |-
$IOS_PODS_PATH -> $IOS_PODFILE_LOCK_PATH
node_modules
- deploy-to-bitrise-io@1.10: {}
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:
- activate-ssh-key@4.0:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@4.0: {}
- script@1.1:
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
- cache-pull@2.1: {}
- get-npm-package-version@1.0: {}
- script@1.1:
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
- yarn@0.1:
title: Run yarn (install dependencies)
- install-missing-android-tools@2.3:
inputs:
- gradlew_path: $ANDROID_GRADLEW_PATH
- script@1.1:
title: Jetify
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
npx jetify
- script@1.1:
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"
- change-android-versioncode-and-versionname@1.2:
inputs:
- build_gradle_path: $ANDROID_BUILD_GRADLE_PATH
- new_version_name: $NPM_PACKAGE_VERSION
title: Set Android version
- script@1.1:
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
- android-build@0.10:
inputs:
- variant: release
- build_type: aab
- project_location: $ANDROID_PATH
- sign-apk@1.7:
inputs:
- android_app: $BITRISE_AAB_PATH
- google-play-deploy@3.1:
inputs:
- service_account_json_key_path: $BITRISEIO_GOOGLE_SERVICES_KEY_URL
- package_name: $APP_IDENTIFIER
- track: internal
- app_path: $BITRISE_SIGNED_AAB_PATH
- certificate-and-profile-installer@1.10: {}
- cocoapods-install@1.11:
inputs:
- podfile_path: $IOS_PODFILE_PATH
- xcode-archive@2.8:
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
- deploy-to-itunesconnect-application-loader@0.11:
inputs:
- itunescon_user: $APPLE_ID
- app_password: $APPLE_PASSWORD
- pkg_path: ''
- appcenter-dsym-upload@0.1:
inputs:
- app_id: $APPCENTER_ORG_NAME/$APPCENTER_APP_NAME_IOS
- api_token: $APPCENTER_API_TOKEN
- git-tag@1.1:
inputs:
- tag: builds/$DEPLOY_ENV/$BITRISE_BUILD_NUMBER
- cache-push@2.3:
inputs:
- is_debug_mode: 'true'
- cache_paths: |-
$IOS_PODS_PATH -> $IOS_PODFILE_LOCK_PATH
node_modules
- deploy-to-bitrise-io@1.10: {}
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:
- activate-ssh-key@4.0:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@4.0: {}
- script@1.1:
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
- cache-pull@2.1:
inputs:
- is_debug_mode: 'true'
- get-npm-package-version@1.0: {}
- script@1.1:
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
- yarn@0.1:
title: Run yarn (install dependencies)
- script@1.1:
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
- bitrise-step-stamp-appicon-with-version-number@1.2:
inputs:
- stamp_version: $NPM_PACKAGE_VERSION
- stamp_path_to_icons: $IOS_APPICON_PATH
title: Stamp iOS AppIcon with version number
- certificate-and-profile-installer@1.10: {}
- cocoapods-install@1.11:
inputs:
- podfile_path: $IOS_PODFILE_PATH
- xcode-archive@2.8:
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
- appcenter-app-release@1.0:
inputs:
- appcenter_org: $APPCENTER_ORG_NAME
- artifact_path: $BITRISE_IPA_PATH
- appcenter_name: $APPCENTER_APP_NAME_IOS
title: AppCenter App Release (iOS)
- appcenter-dsym-upload@0.1:
inputs:
- app_id: $APPCENTER_ORG_NAME/$APPCENTER_APP_NAME_IOS
- api_token: $APPCENTER_API_TOKEN
- git-tag@1.1:
inputs:
- tag: builds/$DEPLOY_ENV/$BITRISE_BUILD_NUMBER
- cache-push@2.3:
inputs:
- is_debug_mode: 'true'
- cache_paths: |-
$IOS_PODS_PATH -> $IOS_PODFILE_LOCK_PATH
node_modules
- deploy-to-bitrise-io@1.10: {}
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:
- activate-ssh-key@4.0:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@4.0: {}
- script@1.1:
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
- cache-pull@2.1: {}
- get-npm-package-version@1.0: {}
- script@1.1:
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
- yarn@0.1:
title: Run yarn (install dependencies)
- install-missing-android-tools@2.3:
inputs:
- gradlew_path: $ANDROID_GRADLEW_PATH
- script@1.1:
title: Jetify
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
npx jetify
- script@1.1:
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"
- change-android-versioncode-and-versionname@1.2:
inputs:
- build_gradle_path: $ANDROID_BUILD_GRADLE_PATH
- new_version_name: $NPM_PACKAGE_VERSION
title: Set Android version
- android-build@0.10:
inputs:
- variant: release
- build_type: aab
- project_location: $ANDROID_PATH
- sign-apk@1.7:
inputs:
- android_app: $BITRISE_AAB_PATH
- google-play-deploy@3.1:
inputs:
- service_account_json_key_path: $BITRISEIO_GOOGLE_SERVICES_KEY_URL
- package_name: $APP_IDENTIFIER
- track: internal
- app_path: $BITRISE_SIGNED_AAB_PATH
- git-tag@1.1:
inputs:
- tag: builds/$DEPLOY_ENV/$BITRISE_BUILD_NUMBER
- cache-push@2.3:
inputs:
- is_debug_mode: 'true'
- cache_paths: |-
$IOS_PODS_PATH -> $IOS_PODFILE_LOCK_PATH
node_modules
- deploy-to-bitrise-io@1.10: {}
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:
- activate-ssh-key@4.0:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@4.0: {}
- script@1.1:
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
- cache-pull@2.1: {}
- get-npm-package-version@1.0: {}
- script@1.1:
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
- yarn@0.1:
title: Run yarn (install dependencies)
- script@1.1:
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
- certificate-and-profile-installer@1.10: {}
- cocoapods-install@1.11:
inputs:
- podfile_path: $IOS_PODFILE_PATH
- xcode-archive@2.8:
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
- deploy-to-itunesconnect-application-loader@0.11:
inputs:
- itunescon_user: $APPLE_ID
- app_password: $APPLE_PASSWORD
- pkg_path: ''
- appcenter-dsym-upload@0.1:
inputs:
- app_id: $APPCENTER_ORG_NAME/$APPCENTER_APP_NAME_IOS
- api_token: $APPCENTER_API_TOKEN
- git-tag@1.1:
inputs:
- tag: builds/$DEPLOY_ENV/$BITRISE_BUILD_NUMBER
- cache-push@2.3:
inputs:
- is_debug_mode: 'true'
- cache_paths: |-
$IOS_PODS_PATH -> $IOS_PODFILE_LOCK_PATH
node_modules
- deploy-to-bitrise-io@1.10: {}
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
<?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