diff --git a/.circleci/config.yml b/.circleci/config.yml index c218cf7e93..64a6b4013a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -59,10 +59,67 @@ commands: type: string replace: type: string + working_directory: + type: string + default: ~/project steps: - run: name: Find and Replace in << parameters.files >> command: node ~/project/scripts/replace.js << parameters.search >> << parameters.replace >> << parameters.files >> + working_directory: << parameters.working_directory >> + + prepare_custom_package: + parameters: + npm_package: + type: string + android_package: + type: string + api_endpoint: + type: string + working_directory: + type: string + default: ~/project + steps: + - run: + name: Remove README.md file + command: rm README.md + working_directory: << parameters.working_directory >> + - find_and_replace: + files: package.json android/sourcemaps.gradle ios/sourcemaps.sh + search: instabug-reactnative + replace: << parameters.npm_package >> + working_directory: << parameters.working_directory >> + - find_and_replace: + files: cli/upload/uploadSourcemaps.ts cli/upload/uploadSoFiles.ts + search: api.instabug.com + replace: << parameters.api_endpoint >> + working_directory: << parameters.working_directory >> + - find_and_replace: + files: android/native.gradle + search: 'com.instabug.library:instabug:' + replace: 'com.instabug.library-<< parameters.android_package >>:instabug:' + working_directory: << parameters.working_directory >> + + prepare_dream11: + parameters: + working_directory: + type: string + default: ~/project + steps: + - install_node_modules + - prepare_custom_package: + npm_package: '@instabug/instabug-reactnative-dream11' + android_package: dream11 + api_endpoint: st001012dream11.instabug.com + working_directory: << parameters.working_directory >> + - run: + name: Give execute permission to Dream11 script + command: chmod +x ./scripts/dream-11-delete-unused-features.sh + working_directory: << parameters.working_directory >> + - run: + name: Remove unused features + command: ./scripts/dream-11-delete-unused-features.sh + working_directory: << parameters.working_directory >> notify_github: parameters: @@ -264,33 +321,16 @@ jobs: release_custom_package: parameters: - npm_package: - type: string - android_package: - type: string - api_endpoint: - type: string + prepare_steps: + type: steps + default: [] working_directory: ~/project executor: name: node/default steps: - advanced-checkout/shallow-checkout + - steps: << parameters.prepare_steps >> - install_node_modules - - run: - name: Remove README.md file - command: rm README.md - - find_and_replace: - files: package.json android/sourcemaps.gradle ios/sourcemaps.sh - search: instabug-reactnative - replace: << parameters.npm_package >> - - find_and_replace: - files: cli/UploadSourcemaps.ts cli/UploadSoFiles.ts - search: api.instabug.com - replace: << parameters.api_endpoint >> - - find_and_replace: - files: android/native.gradle - search: 'com.instabug.library:instabug:' - replace: 'com.instabug.library-<< parameters.android_package >>:instabug:' - run: name: Build the SDK command: yarn build @@ -301,45 +341,6 @@ jobs: name: Publish new enterprise version command: npm publish - # Automate the enterprise D11 sdk changes - release_d11: - working_directory: ~/project - executor: - name: node/default - steps: - - advanced-checkout/shallow-checkout - - install_node_modules - - run: - name: Remove README.md file - command: rm README.md - - find_and_replace: - files: package.json ios/sourcemaps.sh android/sourcemaps.gradle - search: instabug-reactnative - replace: '@instabug/instabug-reactnative-dream11' - - find_and_replace: - files: cli/UploadSourcemaps.ts cli/UploadSoFiles.ts - search: api.instabug.com - replace: st001012dream11.instabug.com - - find_and_replace: - files: android/native.gradle - search: com.instabug.library:instabug - replace: 'com.instabug.library-dream11:instabug' - - run: - name: give exec permssion to d11 script - command: chmod +x ./scripts/dream-11-delete-unused-features.sh - - run: - name: remove un-required features - command: ./scripts/dream-11-delete-unused-features.sh - - run: - name: Build the SDK - command: yarn build - - run: - name: Authorize with npm - command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc - - run: - name: Publish new enterprise version - command: npm publish - publish: macos: xcode: 13.4.1 @@ -463,12 +464,6 @@ workflows: filters: branches: only: master - - hold_release_d11: - requires: *release_dependencies - type: approval - filters: - branches: - only: dream11 - publish: requires: - hold_publish @@ -481,6 +476,7 @@ workflows: filters: branches: only: master + - hold_release_nn: requires: *release_dependencies type: approval @@ -494,9 +490,12 @@ workflows: filters: branches: only: master - npm_package: '@instabug/react-native-nn' - android_package: nn - api_endpoint: st001009nn.instabug.com + prepare_steps: + - prepare_custom_package: + npm_package: '@instabug/react-native-nn' + android_package: nn + api_endpoint: st001009nn.instabug.com + - hold_release_injazat: requires: *release_dependencies type: approval @@ -510,12 +509,24 @@ workflows: filters: branches: only: master - npm_package: '@instabug/react-native-injazat' - android_package: injazat - api_endpoint: st001013mec1.instabug.com - - release_d11: + prepare_steps: + - prepare_custom_package: + npm_package: '@instabug/react-native-injazat' + android_package: injazat + api_endpoint: st001013mec1.instabug.com + + - hold_release_dream11: + requires: *release_dependencies + type: approval + filters: + branches: + only: dream11 + - release_custom_package: + name: release_dream11 requires: - - hold_release_d11 + - hold_release_dream11 filters: branches: only: dream11 + prepare_steps: + - prepare_dream11