You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+94-3Lines changed: 94 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -158,10 +158,101 @@ Could also be a problem with the backend container/app you're requesting the too
158
158
159
159
When developing locally, must point React Native to http://127.0.0.1:8080/products backend instead of https://localhost:8080/products backend.
160
160
161
+
# How To Create a Release
161
162
162
-
## Creating release with APK + .app.zip for [Test-Data Automation](https://github.com/sentry-demos/application-monitoring/tree/master/tests)
163
+
You must complete all of the following steps when setting a new release version:
163
164
164
-
First generate the apps using `npx react-native run-ios --configuration Release` for iOS, and `npx react-native run-android --variant Release` for Andriod
- Increments version by 0.0.1, i.e. `2.0.1` -> `2.0.2`.
175
+
- Automatically keeps versioning consistent across package.json and associated android and ios files
176
+
- Automatically creates a commit for the newly created release, i.e. `2.0.2`
177
+
178
+
You should see:
179
+
180
+

181
+
182
+
We can run `git log` to confirm that the release commit for `2.0.2` was created:
183
+
184
+

185
+
186
+
Be careful about which project you are pointing to when you start ticking releases forward or triggering them. Note that once you tick the release version forward locally (i.e. to `2.0.2`), if you locally trigger an error, the Sentry project you're pointing to will start reporting that error as associated with release `2.0.2` (even though your code is being run locally and is technically not deployed). Such are the dangers of having a demo app's release process not occur during a typical release pipeline.
187
+
188
+
The `npm version patch` command automatically keeps releases consistent across `package.json`, `Info.plist`, and `build.gradle` thanks to [react-native-version](https://github.com/stovmascript/react-native-version).
189
+
190
+
## 2. Create a Github Release
191
+
192
+
It's also crucial that we create a Github release so that our automated test jobs (located in the [application-monitoring repo](https://github.com/sentry-demos/application-monitoring/tree/master/tests)) can create data in Sentry based on the latest react native code.
193
+
194
+
What’s the purpose of this?
195
+
196
+
Basically in the Github releases, we want to make sure certain artifacts are uploaded. For example in this release I did, 1.9, we have .apk and .app.zip artifacts uploaded. The generated artifacts will be uploaded to the Github Release we create. Then, our automated ‘TDA’ (test data automation) tests will use these builds of the app to generate data and populate our Sentry demo projects.
197
+
198
+
This is a guide of how to build those artifacts and create a Github Release, while uploading the relevant artifacts along with the release.
199
+
200
+
### Generate Release/Debug Artifacts
201
+
202
+
(:pencil2: I'm hoping to make this a less manual process in the future so that you can just run one or two scripts. Unfortunately some things I haven't figured out about Xcode are preventing that. -Chris)
203
+
204
+
First: ensure your local repo is up to date with the Github `master` branch via `git pull origin master`.
205
+
206
+
#### iOS
207
+
208
+
1. Generate the Release build
209
+
-`cd` into the root repository directory - `sentry_react_native`
210
+
- Run `npx react-native run-ios --configuration Release`. This will start the iPhone simulator and launch the app but we don’t care about that -- this command also creates the release build.
211
+
- This will result in a directory being populated under /Users/cstavitsky/Library/Developer/Xcode/DerivedData (replace cstavitsky with your local username). There will be a sentry-react-native-<bunchofrandomchars> directory.
212
+
- Copy the newly created release artifact into the current directory: `cp -r /Users/cstavitsky/Library/Developer/Xcode/DerivedData/sentry_react_native-dgoblbkgunhkxscqaagaqprvjqus/Build/Products/Release-iphonesimulator/sentry_react_native.app sentry_react_native.app`[your hash sentry_react_native-<....> will probably be different]
213
+
- Zip the copied directory so that the .zip can be uploaded along with the Github release: `zip -r sentry_react_native.app.zip sentry_react_native.app`
214
+
- If you do a `git status` you should see that `sentry_react_native.app.zip` was `modified`.
215
+
- Run `git add sentry_react_native.app.zip`
216
+
217
+
2. Generate the Debug build
218
+
- Run `npx react-native run-ios --configuration Debug`. This will start the iPhone simulator and launch the app but we don’t care about that -- this command also creates the debug build.
219
+
- This will result in a directory being populated under /Users/cstavitsky/Library/Developer/Xcode/DerivedData (replace cstavitsky with your local username). There will be a sentry-react-native-<bunchofrandomchars> directory.
220
+
- Copy the newly created release artifact into the current directory: `cp -r /Users/cstavitsky/Library/Developer/Xcode/DerivedData/sentry_react_native-dgoblbkgunhkxscqaagaqprvjqus/Build/Products/Debug-iphonesimulator/sentry_react_native.app sentry_react_native_debug.app`[your hash sentry_react_native-<....> will probably be different]
221
+
- Zip the copied directory `zip -r sentry_react_native_debug.app.zip sentry_react_native_debug.app`
222
+
- Run `git add sentry_react_native_debug.app.zip`
223
+
224
+
### Android
225
+
226
+
1. Generate the Release build
227
+
- Run `npx react-native run-android --variant Release`. This will generate the Android release build. Ignore the emulator.
228
+
- Copy the release build to the root directory of the project: `cp android/app/build/outputs/apk/release/app-release.apk ./`
229
+
- Run `git add app-release.apk`
230
+
231
+
2. Generate the Debug build
232
+
- Run `npx react-native run-android --variant Debug`. This will generate the Android debug build. Ignore the emulator.
233
+
- Copy the debug build to the root directory of the project: `cp android/app/build/outputs/apk/debug/app-debug.apk ./`
234
+
- Run `git add app-debug.apk`
235
+
236
+
Create a Github Release:
237
+
238
+
Note: do not proceed with this until you have done all the previous steps.
239
+
240
+
1. (If this is your first time doing this, run `brew install gh` to install the Github CLI tool. Once you install it, you can skip this step in the future)
241
+
2. Commit the four files `git commit -m “Add release artifacts”`
242
+
3. Run the release script `./github_release.sh`, and select yes when prompted.
243
+
244
+
Your new release should be [visible on Github](https://github.com/sentry-demos/sentry_react_native/releases).
245
+
246
+
### [Troubleshooting - Locally undoing an accidental increment of the release version]
247
+
248
+
If you accidentally tick the version forward by running `npm version patch`, and did not intend to do so, you can undo this.
249
+
250
+
Let's say we were previously on `2.0.1` and accidentally ran the command twice, ticking the release to `2.0.2` and `2.0.3`, but we only wanted to go to `2.0.2`.
251
+
252
+
- First, run `git log`.
253
+
- Copy the commit hash associated with the previous commit that you want to reset to.
254
+
255
+

256
+
257
+
- run `git reset <the commit hash>`.
258
+
- Check out any unwanted files that are no longer staged for commit.
0 commit comments