@@ -21,6 +21,11 @@ executors:
2121orbs :
2222 android :
circleci/[email protected] 2323
24+ run_on_master : &run_on_master
25+ filters :
26+ branches :
27+ only : main
28+
2429commands :
2530 attach_project :
2631 steps :
@@ -159,14 +164,58 @@ jobs:
159164 - ~/project/example/ios/Pods
160165
161166 - run :
162- working_directory : example/e2e
163- name : Build
164- command : npm run build:ios
167+ working_directory : example/e2e
168+ name : Build
169+ command : npm run build:ios
170+
171+ - run :
172+ working_directory : example/e2e
173+ name : Run UI Tests
174+ command : npm run test:ios
175+
176+
177+ release-to-npm :
178+ executor : default
179+ steps :
180+ - checkout
181+ - run :
182+ name : Set user credentials
183+ command : |
184+ git config user.email $GIT_USER_EMAIL
185+ git config user.name $GIT_USER_NAME
186+
187+ # Tokens are stored in bas64
188+ - run :
189+ name : Instal SSH KEY
190+ command : |
191+ ssh-add -D
192+ echo $GIT_WRITE_SSH_KEY | base64 --decode > ~/.ssh/id_ed25519
193+ echo $GIT_WRITE_SSH_KEY_PUB | base64 --decode > ~/.ssh/id_ed25519.pub
194+
195+ - run :
196+ name : Change key permission
197+ command : chmod 600 ~/.ssh/id_ed25519
198+
199+ - run :
200+ name : Add ssh key
201+ command : ssh-add ~/.ssh/id_ed25519
202+
203+ - run :
204+ name : Add npm registry auth key
205+ command : echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc
206+
207+ - restore_cache :
208+ keys :
209+ - dependencies-{{ checksum "package.json" }}
210+
211+ - run :
212+ name : Install dependencies
213+ command : |
214+ yarn install --frozen-lockfile
165215
166216 - run :
167- working_directory : example/e2e
168- name : Run UI Tests
169- command : npm run test:ios
217+ name : Release package
218+ command : npm run release --ci
170219
171220
172221workflows :
@@ -191,3 +240,15 @@ workflows:
191240 - ios-e2e-test :
192241 requires :
193242 - install-dependencies
243+ - release-to-npm :
244+ << : *run_on_master
245+ context :
246+ - react-native-env
247+ requires :
248+ - install-dependencies
249+ - lint
250+ - typescript
251+ - unit-tests
252+ - build-package
253+ - ios-e2e-test
254+ - android-e2e-test
0 commit comments