Skip to content
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

docs: add guide for releasing an app with code push #36

Merged
merged 31 commits into from
May 18, 2023
Merged
Changes from 28 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
6dd1301
docs: minor copy edits to initialize.md
bryanoltman May 4, 2023
f671a90
docs: adds code push quickstart guide
bryanoltman May 4, 2023
ecbcac3
Merge branch 'main' into bo/code-push-quickstart
bryanoltman May 16, 2023
c8fc1d5
Merge branch 'main' into bo/code-push-quickstart
bryanoltman May 18, 2023
c432237
format
bryanoltman May 18, 2023
4853974
Move quickstart to tutorials section
bryanoltman May 18, 2023
973868b
format
bryanoltman May 18, 2023
3995ff4
update positions
bryanoltman May 18, 2023
1d662eb
rename app for clarity
bryanoltman May 18, 2023
a4f5f55
Fix link
bryanoltman May 18, 2023
f02b1e3
docs: add code push release guide
bryanoltman May 18, 2023
ca712b4
update release docs through creating the release step
bryanoltman May 18, 2023
95ad2f7
Merge branch 'main' into bo/code-push-release-guide
bryanoltman May 18, 2023
041d721
Fix merge issues
bryanoltman May 18, 2023
023c153
tweak
bryanoltman May 18, 2023
3ab41a3
add screenshots
bryanoltman May 18, 2023
1069d63
add play store link
bryanoltman May 18, 2023
ae9343b
minor updates
bryanoltman May 18, 2023
57c74f0
Formatting, add GH links
bryanoltman May 18, 2023
8458f21
Add patch instructions
bryanoltman May 18, 2023
e330cd1
fix link
bryanoltman May 18, 2023
1e18b2d
Fix typo
bryanoltman May 18, 2023
f7a48ac
Copy edit
bryanoltman May 18, 2023
e2f98fb
Remove "you"
bryanoltman May 18, 2023
d4e0df2
standardize header casing
bryanoltman May 18, 2023
5c6f110
Add clarity to shorebird releases list command
bryanoltman May 18, 2023
29c6357
bulk copy edits
bryanoltman May 18, 2023
22b8db8
Merge branch 'bo/code-push-release-guide' of github.com:shorebirdtech…
bryanoltman May 18, 2023
56d5837
Add delete branch instructions
bryanoltman May 18, 2023
08e1358
Add note about the commit still existing
bryanoltman May 18, 2023
408ae4c
Merge branch 'main' into bo/code-push-release-guide
bryanoltman May 18, 2023
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
252 changes: 252 additions & 0 deletions docs/guides/code_push_release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,252 @@
---
sidebar_position: 2
title: 🚒 Release a Code Push App
description: Release a Code Push App
---

# Releasing a code push app

This guide walks through releasing a code push app to the Play Store and applying a patch to that release.

## Prerequisites

This guide assumes that you have an existing Shorebird app. If you don't have one, you can create one by following the [code push quickstart](./code_push_quickstart/) guide.

The app we will be releasing in this guide is [`Time Shift`](https://play.google.com/store/apps/details?id=dev.shorebird.u_shorebird_clock), our demo code push app. ([source](https://github.com/shorebirdtech/time_shift/))

## Creating a release

### Determine next release version

Start by running `shorebird releases list` to see the current set of releases:

```
bryanoltman@boltman ~/Shorebird/time_shift (main)
⑆ shorebird releases list
πŸš€ Releases (51751336-6a7c-4972-b4ec-8fc1591fb2b3)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”
β”‚ Version β”‚ Name β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€
β”‚ 1.0.1 β”‚ -- β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€
β”‚ 1.0.2+1 β”‚ -- β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€
β”‚ 1.0.2+5 β”‚ -- β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”˜
```

This shows that the most recent release is `1.0.2+5`. This corresponds with what we see in the Play Store console:

![ReleaseVersion](https://github.com/shorebirdtech/docs/assets/581764/e6b6c276-49de-4142-8f32-dbf5e41379fa)

Next, we'll create a new release for version `1.0.3+6`.

### Make code changes

Version `1.0.3+6` of Time Shift will change the default clock face from `particle` to `generative`.

To make this change, edit `lib/main.dart`:

```diff
final clock = ClockFace.values.firstWhere(
(clock) => clock.name == clockName,
- orElse: () => ClockFace.particle,
+ orElse: () => ClockFace.generative,
);
```

Verify that this change does what we expect by running the app with `shorebird run`.

Once this change has been verified, commit this change and push it to GitHub:

```sh
git add lib/main.dart
git commit -m "Change default clock face to generative"
git push
```

[On GitHub](https://github.com/shorebirdtech/time_shift/commit/d1fe9451aa18a775163bce95dd9dab551aaf6259)

### Update app version

Next, bump the app version in `pubspec.yaml`:

```diff
name: time_shift
description: Demo app showing Shorebird updates.
publish_to: "none"

-version: 1.0.2+5
+version: 1.0.3+6

environment:
sdk: ">=2.19.4 <3.0.0"
bryanoltman marked this conversation as resolved.
Show resolved Hide resolved
```

Commit, tag, and push the change.

```sh
git add pubspec.yaml
git commit -m "Update app version to 1.0.3+6"
git tag v1.0.3+6
git push # Push the commit
git push --tags # Push the tag
```

[On GitHub](https://github.com/shorebirdtech/time_shift/commit/3b25df1888c170c2418162ba64a9a5e6363c09af)

### Create a Shorebird release

To create a Shorebird release, run `shorebird release`. You should see output similar to the following:

```
bryanoltman@boltman ~/Shorebird/time_shift (main)
⑆ shorebird release
βœ“ Building release (17.0s)
βœ“ Fetching apps (0.3s)
βœ“ Detecting release version (0.2s)

πŸš€ Ready to create a new release!

πŸ“± App: time_shift (51751336-6a7c-4972-b4ec-8fc1591fb2b3)
πŸ“¦ Release Version: 1.0.3+6
πŸ•ΉοΈ Platform: android (arm64, arm32, x86_64)

Would you like to continue? (y/N) Yes
βœ“ Fetching releases (70ms)
βœ“ Fetching Flutter revision (22ms)
βœ“ Creating release (61ms)
βœ“ Creating artifacts (2.5s)

βœ… Published Release!

Your next step is to upload the app bundle to the Play Store.
./build/app/outputs/bundle/release/app-release.aab

See the following link for more information:
https://support.google.com/googleplay/android-developer/answer/9859152?hl=en
```

### Upload to the Play Store

As per the instructions above, we must upload the generated `.aab` to the Play Store.

1. Navigate to the [Play Console](https://play.google.com/console/developers).
1. Choose your developer account (for us, it's Shorebirdbird.dev).
1. Select the Time Shift app.
1. Select "Testing -> Open Testing" from the side bar.
1. Click the "Create new release" button.

![CreateNewRelease](https://github.com/shorebirdtech/docs/assets/581764/90c9c7ed-bc39-4731-bfec-524f89e2baf6)

Upload the `.aab` file located at `./build/app/outputs/bundle/release/app-release.aab`.

1. From the root directory of the project, run `open ./build/app/outputs/bundle/release/` to open the folder containing the `.aab` in Finder.
1. Drag `app-release.aab` into the Play Console to upload.

Once the upload completes, the Play Store will correctly recognize the new version as `6 (1.0.3)`.

![UploadedBundle](https://github.com/shorebirdtech/docs/assets/581764/1994cb5a-4cd6-4f1b-a88c-f5aaa3d1433d)

Click "Next" and then "Save" (both in the bottom-right corner) to submit.

This will take you to the publishing overview page. Click "Submit for review" to submit the release for review.

You should now see a release in the Play Store console with an "In review" status:

![InReview](https://github.com/shorebirdtech/docs/assets/581764/4cfdc7fb-2049-4110-b1cd-da99c7a491f7)

Now you must wait for the Play Store to approve the release.

### Create a GitHub release

It's recommended to create a GitHub release as well.

1. Navigate to https://github.com/shorebirdtech/time_shift/releases.
1. Click "Draft a new release".
1. Choose the tag we created earlier (`v1.0.3+6`).
1. Title the release "v1.0.3+6".
1. Add a description of the release ("Changes the default clock face to 'generative'").
1. Publish the release.

## After the release is approved

Once the release has been approved, you will be able to download it from the Play Store.

## Creating a patch

Patches can be pushed to fix bugs in the `1.0.3+6` release without requiring a new submission to the Play Store.

### Make the change

Start by checking out the `v1.0.3+6` release tag:

```sh
git checkout v1.0.3+6
```

Next, create a branch, as this change will represent a divergence from the `main` branch:

```sh
git checkout -b v1.0.3+6-patch1
bryanoltman marked this conversation as resolved.
Show resolved Hide resolved
```

For the purposes of this guide, we will change the default clock face back to `particle` in `lib/main.dart`:

```diff
(clock) => clock.name == clockName,
- orElse: () => ClockFace.generative,
+ orElse: () => ClockFace.particle,
);
```

Commit the change and push our new patch branch:

```sh
git add lib/main.dart
git commit -m "Change default clock face to particle"
git push --set-upstream origin v1.0.3+6-patch1
```

Tag this commit as `v1.0.3+6-patch1`:

```sh
git tag v1.0.3+6-patch1
git push --tags
```

[On GitHub](https://github.com/shorebirdtech/time_shift/commit/cf4054bada74ff1c5ff84fb9aceb3f1e4442203f)

### Create a Shorebird patch

Finally, push the patch with `shorebird patch`. You should see output similar to the following:

```
bryanoltman@boltman ~/Shorebird/time_shift (main)
⑆ shorebird patch
βœ“ Building patch (17.2s)
βœ“ Fetching apps (0.7s)
βœ“ Detecting release version (0.2s)
βœ“ Fetching release (99ms)
βœ“ Fetching Flutter revision (13ms)
βœ“ Fetching release artifacts (0.2s)
βœ“ Downloading release artifacts (1.0s)
βœ“ Creating artifacts (1.0s)

πŸš€ Ready to publish a new patch!

πŸ“± App: time_shift (51751336-6a7c-4972-b4ec-8fc1591fb2b3)
πŸ“¦ Release Version: 1.0.3+6
πŸ“Ί Channel: stable
πŸ•ΉοΈ Platform: android [arm64 (135 B), arm32 (150 B), x86_64 (135 B)]

Would you like to continue? (y/N) Yes
βœ“ Creating patch (0.1s)
βœ“ Uploading artifacts (0.9s)
βœ“ Fetching channels (90ms)
βœ“ Promoting patch to stable (61ms)

βœ… Published Patch!
```

This patch will now be available to users with version `1.0.3+6` of the app.