Skip to content

ci: generalize enterprise releases #1275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 85 additions & 74 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -481,6 +476,7 @@ workflows:
filters:
branches:
only: master

- hold_release_nn:
requires: *release_dependencies
type: approval
Expand All @@ -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
Expand All @@ -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