diff --git a/bitrise.yml b/bitrise.yml new file mode 100644 index 0000000..4456a1c --- /dev/null +++ b/bitrise.yml @@ -0,0 +1,532 @@ +--- +format_version: "8" +default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git +project_type: flutter +workflows: + Changelog: + steps: + - ? git::https://github.com/nodes-android/ci-bitrise-changelog-step@feature/convcommits + : inputs: + - custom_other_name: "\U0001F4BE Other changes" + checkGitAccess: + steps: + - activate-ssh-key@4: + run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' + - git-clone@4: {} + after_run: [] + + deployDevelopmentInternal: + steps: + - activate-ssh-key@4: + run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' + - git-clone@6.0: {} + - script@1: + inputs: + - content: |- + #See: https://devcenter.bitrise.io/infrastructure/virtual-machines/#managing-java-versions + jenv global 11 + export JAVA_HOME="$(jenv prefix)" + envman add --key JAVA_HOME --value "$(jenv prefix)" + title: Set Java Version 11 + - fastlane-match@0.2: + inputs: + - git_branch: "$MATCH_GIT_BRANCH" + - app_id: "$BUNDLE_ID_DEVELOPMENT" + - decrypt_password: "$MATCH_DECRYPT" + - type: adhoc + - team_id: "$DEVELOPER_TEAM" + - git_url: git@github.com:nodes-projects/internal-certificates-ios.git + - flutter-installer@0: {} + - script@1: + title: Flutter Pub Get + inputs: + - content: flutter pub get + - flutter-build@0: + inputs: + - ios_additional_params: + " --debug --no-codesign -t lib/main_development.dart + --flavor development --build-number=$BITRISE_BUILD_NUMBER" + - cache_level: none + - android_output_type: appbundle + - android_additional_params: + "--release -t lib/main_development.dart --flavor + development --build-number=$BITRISE_BUILD_NUMBER" + - xcode-archive@3: + inputs: + - configuration: Release-development + - export_method: ad-hoc + - team_id: "$DEVELOPER_TEAM" + - scheme: development + - deploy-to-bitrise-io@1: {} + - script@1: + inputs: + - content: |- + #!/bin/bash + + input=${BITRISE_PUBLIC_INSTALL_PAGE_URL_MAP} + inputs=($(echo "$input" | tr '|' '\n')) + + for i in "${inputs[@]}" + do + if [[ "$i" == *".apk"* ]]; then + androidLink=${i##*=>} + elif [[ "$i" == *".ipa"* ]]; then + iosLink=${i##*=>} + else + echo "No install page link found." + fi + done + + echo "android: $androidLink" + echo "ios: $iosLink" + + envman add --key ANDROID_INSTALL_PAGE_LINK --value "${androidLink}" + envman add --key IOS_INSTALL_PAGE_LINK --value "${iosLink}" + title: Set Install Page Links + - script@1: + title: Set Build Version + inputs: + - content: |- + #!/usr/bin/env bash + + input=`grep -w version: pubspec.yaml` + inputs=($(echo "$input" | tr 'version:' '\n')) + + version="${inputs[@]}" + + echo "BUILD_VERSION: ${version}" + + envman add --key BUILD_VERSION --value "${version}" + - script@1: + inputs: + - content: envman add --key BUILD_FLAVOUR --value "DEVELOPMENT" + title: Set Build Flavour + - script@1: + title: Cleanup + inputs: + - content: rm -r $BITRISE_DEPLOY_DIR/* + after_run: + - notifySlack + deployStagingExternal: + steps: + - activate-ssh-key@4: + run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' + - git-clone@6: + inputs: + - fetch_tags: "yes" + - script@1: + title: Set Java Version 11 + inputs: + - content: |- + #See: https://devcenter.bitrise.io/infrastructure/virtual-machines/#managing-java-versions + jenv global 11 + export JAVA_HOME="$(jenv prefix)" + envman add --key JAVA_HOME --value "$(jenv prefix)" + - script@1: + inputs: + - content: envman add --key BUILD_FLAVOUR --value "STAGING" + title: Set Build Flavour + - script@1: + title: Set Build Version + inputs: + - content: |- + #!/usr/bin/env bash + + input=`grep -w version: pubspec.yaml` + inputs=($(echo "$input" | tr 'version:' '\n')) + + version="${inputs[@]}" + + echo "BUILD_VERSION: ${version}" + + envman add --key BUILD_VERSION --value "${version}" + - git-tag@1: + inputs: + - tag: "${BUILD_VERSION}-${BITRISE_BUILD_NUMBER}" + - fastlane-match@0.2: + inputs: + - git_branch: "$MATCH_GIT_BRANCH" + - app_id: "$BUNDLE_ID_STAGING" + - decrypt_password: "$MATCH_DECRYPT" + - type: adhoc + - team_id: "$DEVELOPER_TEAM" + - git_url: git@github.com:nodes-projects/internal-certificates-ios.git + - flutter-installer@0: {} + - script@1: + title: Flutter Pub Get + inputs: + - content: flutter pub get + - flutter-build@0: + inputs: + - ios_additional_params: + " --debug --no-codesign -t lib/main_staging.dart + --flavor staging --build-number=$BITRISE_BUILD_NUMBER" + - cache_level: none + - android_output_type: appbundle + - android_additional_params: + "--release -t lib/main_staging.dart --flavor + staging --build-number=$BITRISE_BUILD_NUMBER" + - set-env-var@0: + inputs: + - value: "$BUNDLE_ID_STAGING" + - destination_keys: APP_BUNDLE_ID + - xcode-archive@3: + inputs: + - configuration: Release-staging + - export_method: ad-hoc + - team_id: "$DEVELOPER_TEAM" + - scheme: staging + - deploy-to-bitrise-io@1: {} + - script@1: + inputs: + - content: |- + #!/bin/bash + + input=${BITRISE_PUBLIC_INSTALL_PAGE_URL_MAP} + inputs=($(echo "$input" | tr '|' '\n')) + + for i in "${inputs[@]}" + do + if [[ "$i" == *".apk"* ]]; then + androidLink=${i##*=>} + elif [[ "$i" == *".ipa"* ]]; then + iosLink=${i##*=>} + else + echo "No install page link found." + fi + done + + echo "android: $androidLink" + echo "ios: $iosLink" + + envman add --key ANDROID_INSTALL_PAGE_LINK --value "${androidLink}" + envman add --key IOS_INSTALL_PAGE_LINK --value "${iosLink}" + title: Set Install Page Links + - google-play-deploy@3: + inputs: + - package_name: "$BUNDLE_ID_STAGING" + - release_name: "${BUILD_VERSION} (${BITRISE_BUILD_NUMBER})" + - service_account_json_key_path: "$BITRISEIO_GOOGLE_PLAY_SERVICE_ACCOUNT_KEY_URL" + after_run: + - deployTestflight + - Changelog + - Release + - notifySlackExternal + deployProductionExternal: + steps: + - activate-ssh-key@4: + run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' + - git-clone@4: {} + - script@1: + title: Set Java Version 11 + inputs: + - content: |- + #See: https://devcenter.bitrise.io/infrastructure/virtual-machines/#managing-java-versions + jenv global 11 + export JAVA_HOME="$(jenv prefix)" + envman add --key JAVA_HOME --value "$(jenv prefix)" + - fastlane-match@0.2: + inputs: + - git_branch: "$MATCH_GIT_BRANCH" + - app_id: "$BUNDLE_ID_PRODUCTION" + - decrypt_password: "$MATCH_DECRYPT" + - type: adhoc + - team_id: "$DEVELOPER_TEAM" + - git_url: git@github.com:nodes-projects/internal-certificates-ios.git + - flutter-installer@0: {} + - script@1: + title: Flutter Pub Get + inputs: + - content: flutter pub get + - flutter-build@0: + inputs: + - ios_additional_params: + " --release --no-codesign -t lib/main_production.dart + --flavor production --build-number=$BITRISE_BUILD_NUMBER" + - cache_level: none + - android_output_type: appbundle + - android_additional_params: + "--release -t lib/main_production.dart --flavor + production --build-number=$BITRISE_BUILD_NUMBER" + - set-env-var@0: + inputs: + - value: "$BUNDLE_ID_PRODUCTION" + - destination_keys: APP_BUNDLE_ID + - xcode-archive@3: + inputs: + - configuration: Release-production + - export_method: ad-hoc + - team_id: "$DEVELOPER_TEAM" + - scheme: production + - deploy-to-bitrise-io@1: {} + - script@1: + inputs: + - content: |- + #!/bin/bash + + input=${BITRISE_PUBLIC_INSTALL_PAGE_URL_MAP} + inputs=($(echo "$input" | tr '|' '\n')) + + for i in "${inputs[@]}" + do + if [[ "$i" == *".apk"* ]]; then + androidLink=${i##*=>} + elif [[ "$i" == *".ipa"* ]]; then + iosLink=${i##*=>} + else + echo "No install page link found." + fi + done + + echo "android: $androidLink" + echo "ios: $iosLink" + + envman add --key ANDROID_INSTALL_PAGE_LINK --value "${androidLink}" + envman add --key IOS_INSTALL_PAGE_LINK --value "${iosLink}" + title: Set Install Page Links + - script@1: + title: Set Build Version + inputs: + - content: |- + #!/usr/bin/env bash + + input=`grep -w version: pubspec.yaml` + inputs=($(echo "$input" | tr 'version:' '\n')) + + version="${inputs[@]}" + + echo "BUILD_VERSION: ${version}" + + envman add --key BUILD_VERSION --value "${version}" + - script@1: + title: Set Build Flavour + inputs: + - content: envman add --key BUILD_FLAVOUR --value "PRODUCTION" + - google-play-deploy@3: + inputs: + - package_name: "$BUNDLE_ID_PRODUCTION" + - release_name: "${BUILD_VERSION} (${BITRISE_BUILD_NUMBER})" + - service_account_json_key_path: "$BITRISEIO_GOOGLE_PLAY_SERVICE_ACCOUNT_KEY_URL" + after_run: + - deployTestflight + - notifySlack + - tag + deployTestflight: + steps: + - fastlane-match@0.2: + inputs: + - git_branch: "$MATCH_GIT_BRANCH" + - decrypt_password: "$MATCH_DECRYPT" + - type: appstore + - team_id: "$DEVELOPER_TEAM" + - app_id: "$BUNDLE_ID_STAGING" + - options: "--readonly" + - git_url: git@github.com:nodes-projects/internal-certificates-ios.git + - export-xcarchive@3.0: + inputs: + - team_id: "$DEVELOPER_TEAM" + - verbose_log: "no" + - export_method: app-store + - deploy-to-itunesconnect-deliver@2.21: + inputs: + - skip_app_version_update: "yes" + - bundle_id: "$BUNDLE_ID_STAGING" + - connection: "off" + - team_id: "$DEVELOPER_TEAM" + - team_name: "$TEAM_NAME" + - api_issuer: "$ASC_APP_KEY_ISSUER_ID" + - api_key_path: "$BITRISEIO_ASC_APP_KEY_URL" + - pkg_path: "" + notifySlack: + steps: + - slack@3.1: + inputs: + - channel: "$NOTIFY_SLACK_INTERNAL_CHANNEL" + - emoji: ":bitrise:" + - icon_url: "" + - author_name: "" + - title: "" + - message: "" + - footer: "" + - footer_icon: "" + - buttons: | + Build|${BITRISE_BUILD_URL} + Android Install Page|${ANDROID_INSTALL_PAGE_LINK} + iOS Install Page|${IOS_INSTALL_PAGE_LINK} + - fields: | + App|${BITRISE_APP_TITLE} + Version|${BUILD_VERSION} (${BITRISE_BUILD_NUMBER}) + Branch|${BITRISE_GIT_BRANCH} + Workflow|${BITRISE_TRIGGERED_WORKFLOW_ID} + - api_token: "$SLACK_TOKEN" + - pretext: "*${BUILD_FLAVOUR}* BUILD" + - webhook_url: "" + is_always_run: false + notifySlackExternal: + steps: + - slack@3.1: + inputs: + - channel: "$NOTIFY_SLACK_EXTERNAL_CHANNEL" + - emoji: ":bitrise:" + - icon_url: "" + - author_name: "" + - title: "" + - message: "" + - footer: "" + - footer_icon: "" + - buttons: | + Build|${BITRISE_BUILD_URL} + Changelog|${GITHUB_PROJECT_URL}/releases/tag/${BUILD_VERSION}-${BITRISE_BUILD_NUMBER} + Android Install Page|${ANDROID_INSTALL_PAGE_LINK} + iOS Install Page|${IOS_INSTALL_PAGE_LINK} + - fields: | + App|${BITRISE_APP_TITLE} + Version|${BUILD_VERSION} (${BITRISE_BUILD_NUMBER}) + Branch|${BITRISE_GIT_BRANCH} + Workflow|${BITRISE_TRIGGERED_WORKFLOW_ID} + - api_token: "$SLACK_TOKEN" + - pretext: "*${BUILD_FLAVOUR}* BUILD" + - webhook_url: "" + is_always_run: false + PR-Validation: + steps: + - activate-ssh-key@4: {} + - git-clone@6: {} + - set-java-version@1: {} + - flutter-installer@0: {} + - script@1: + inputs: + - content: |- + #!/usr/bin/env bash + # fail if any commands fails + set -e + # make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully + set -o pipefail + # debug log + set -x + + flutter pub get + title: Pub Get + - script@1: + inputs: + - content: |- + #!/usr/bin/env bash + # fail if any commands fails + set -e + # make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully + set -o pipefail + # debug log + set -x + + flutter format --set-exit-if-changed lib/ + title: Format + - script@1: + title: Analyze + inputs: + - content: |- + #!/usr/bin/env bash + # fail if any commands fails + set -e + # make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully + set -o pipefail + # debug log + set -x + + flutter analyze + - script@1: + inputs: + - content: |- + #!/usr/bin/env bash + # fail if any commands fails + set -e + # make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully + set -o pipefail + # debug log + set -x + + flutter test + title: Test + - script@1: + title: Build Staging + inputs: + - content: |- + #!/usr/bin/env bash + # fail if any commands fails + set -e + # make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully + set -o pipefail + # debug log + set -x + + flutter build apk --release --flavor staging -t lib/main_staging.dart + Release: + steps: + - github-release@0: + inputs: + - body: "$COMMIT_CHANGELOG" + - username: "$GITHUB_USERNAME" + - api_token: "$GITHUB_PERSONAL_TOKEN" + - draft: "no" + - tag: "${BUILD_VERSION}-${BITRISE_BUILD_NUMBER}" + - name: "${BUILD_VERSION}-${BITRISE_BUILD_NUMBER}" + tag: + steps: + - git-tag@1: + inputs: + - tag: "${BUILD_VERSION}-${BITRISE_BUILD_NUMBER}" + +#TODO: Change these vars according to the project +app: + envs: + - opts: + is_expand: false + BITRISE_FLUTTER_PROJECT_LOCATION: "." + - opts: + is_expand: false + BITRISE_PROJECT_PATH: ios/Runner.xcworkspace + - opts: + is_expand: false + BITRISE_SCHEME: Runner + - opts: + is_expand: false + BITRISE_EXPORT_METHOD: ad-hoc + - opts: + is_expand: false + ANDROID_INSTALL_PAGE_LINK: "" + - opts: + is_expand: false + IOS_INSTALL_PAGE_LINK: "" + - opts: + is_expand: false + BUILD_VERSION: "" + - DEVELOPER_TEAM: 123FAMILY321 + - MATCH_GIT_BRANCH: matchbranch + - BUNDLE_ID_STAGING: bundle.id.staging + - BUNDLE_ID_PRODUCTION: bundle.id.production + - TEAM_NAME: Fast and Furious Tokyo Drift (FAMILY) + - NOTIFY_SLACK_INTERNAL_CHANNEL: "#family" + - NOTIFY_SLACK_EXTERNAL_CHANNEL: "#family(external)" + - opts: + is_expand: false + BUNDLE_ID_DEVELOPMENT: bundle.id.development + - opts: + is_expand: false + BUILD_FLAVOUR: Unknown + - opts: + is_expand: false + GITHUB_PROJECT_URL: https://github.com/org/repo + - opts: + is_expand: false + ASC_APP_KEY_ISSUER_ID: 123abc-456efg +trigger_map: + - push_branch: develop + workflow: deployDevelopmentInternal + - push_branch: staging + workflow: deployStagingExternal + - push_branch: production + workflow: deployProductionExternal + - pull_request_source_branch: "*" + workflow: PR-Validation +meta: + bitrise.io: + stack: osx-xcode-13.1.x