Skip to content

Commit

Permalink
Merge branch 'trunk' into cli/gbm-patch
Browse files Browse the repository at this point in the history
  • Loading branch information
jhnstn committed Nov 7, 2023
2 parents 6942683 + 11cbc24 commit e5e137c
Show file tree
Hide file tree
Showing 70 changed files with 270 additions and 122 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ jobs:
uses: actions/setup-go@v4
with:
go-version: '1.21'

- name: Install dependencies
run: |
cd ./cli
cd ./gbm-cli
go get .
- name: Test
run: |
cd cli
cd ./gbm-cli
go test -v ./...
14 changes: 11 additions & 3 deletions cli/README.md → gbm-cli/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
# GBM CLI

## Overview
The GBM cli tool helps developmental tasks for managing Gutenberg Mobile releases.
The GBM CLI tool helps developmental tasks for managing Gutenberg Mobile releases.

The current features include:
- Command to generate the release checklist
- Commands to wrangle Gutenberg Mobile releases

## Prerequisites
Download and install the [Go package](https://go.dev/doc/install).
## Development Environment
1. Download and install the [Go package](https://go.dev/doc/install).
2. While not required, it is higly recommended to develop with [VSCode](https://code.visualstudio.com/) and install the [Go VSCode](https://marketplace.visualstudio.com/items?itemName=golang.go) extension.

## Releasing
For detailed instructions on running a release, visit [Releasing.md](https://github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/blob/cli/update-checklist/cli/Releasing.md).

## Testing
For detailed instructions on testing and configuring your development environment, visit [Testing.md](https://github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/blob/cli/update-checklist/cli/Testing.md).



## Structure
Expand Down
128 changes: 128 additions & 0 deletions gbm-cli/Releasing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Release Checklist Template

The Release Checklist Template can be generated with the following command: (replacing `X.XX.X` with the applicable release number):

```
go run main.go render checklist -v X.XX.X
```

The `--c` flag will copy the output to your clipboard. To view the output in the command line, simply remove the `--c` flag.


If the release is a betafix/hotfix, include a message explaining briefly the reason for releasing the fix.
**Example:**

```
go run main.go render checklist -v X.XX.X --message "This hotfix addresses ISSUE_OR_CRASH in ORIGINAL_VERSION. See P2_PR_SLACK_ETC_LINK_OR_LINKS for the rationale behind the decision to make it."
```

# Different types of releases

## Best practices

It's best practice to use the automation script (mentioned in the release template above) for all releases types (alpha, regular, betafix, hotfix). When wrangling a betafix or hotfix, it's important to merge the fix to Gutenberg `trunk` independently of the release process. When the release is cut (by the automation script) the commit(s) that make up the betafix or hotfix should then be cherry-picked onto the Gutenberg release branch.

## 1. Alpha

### When

Whenever a build is needed for testing (usually a few days prior to a Regular release).

### Branches

For example, when the next release will be `1.11.0`.

| Repo | Cut From | Branch Name |
| ---------------- | -------- | ----------------------------------------- |
| gutenberg | trunk | rnmobile/release_1.11.0-alpha1 |
| gutenberg-mobile | trunk | release/1.11.0-alpha1 |
| WPAndroid | trunk | gutenberg/integrate_release_1.11.0-alpha1 |
| WPiOS | trunk | gutenberg/integrate_release_1.11.0-alpha1 |

### Automation script differences

Compared to a Regular release, the differences here are:

- When the script asks for the new version number, don't forget to add the `-alpha` suffix (e.g. `1.11.0-alpha1`).
- All PRs created by the release script should be edited to clarify that they are temporary and will be deleted when testing is finished.

### Release checklist template differences

The release checklist is not used for alpha releases. When testing is finished, please close all PRs and delete all branches created by the script.

## 2. Regular

### When

On Thursdays, the week before the main apps (WPiOS & WPAndroid) have cut their releases, every 2 weeks.

### Branches

For example when releasing gutenberg-mobile `1.11.0`.

| Repo | Cut From | Branch Name | Merging To |
| ---------------- | -------- | ---------------------------------- | --------------- |
| gutenberg | trunk | rnmobile/release_1.11.0 | trunk |
| gutenberg-mobile | trunk | release/1.11.0 | trunk |
| WPAndroid | trunk | gutenberg/integrate_release_1.11.0 | trunk |
| WPiOS | trunk | gutenberg/integrate_release_1.11.0 | trunk |

## 3. Betafix

### When

A fix is targeting a main app version that is not yet released (meaning the release branch is cut but it's still in beta) and a new gutenberg-mobile release is needed.

### Branches

For example when releasing gutenberg-mobile `1.11.1` while main apps version `22.2.0` is in beta which currently has gutenberg-mobile `1.11.0` in it.
At the same time there could also be a regular release going on for example for gutenberg-mobile version `1.12.0`.

| Repo | Cut From | Branch Name | Merging To |
| ---------------- | ----------------------- | ---------------------------------- | ---------------------------------------------------------------- |
| gutenberg | rnmobile/release_1.11.0 (tag) | rnmobile/release_1.11.1 | trunk & (maybe also) rnmobile/release_1.12.0 |
| gutenberg-mobile | v1.11.0 (tag) | release/1.11.1 | trunk & (maybe also) release/1.12.0 |
| WPAndroid | release/22.2.0 | gutenberg/integrate_release_1.11.1 | release/22.2.0 & (maybe also) gutenberg/integrate_release_1.12.0 |
| WPiOS | release/22.2.0 | gutenberg/integrate_release_1.11.1 | release/22.2.0 & (maybe also) gutenberg/integrate_release_1.12.0 |

### Automation script differences

1. Run the CLI tool as normal
1. When asked by the script enter the relevant branch names to cut from (to target) in other repos.
1. If a commit that is fixing the issue is already merged to gutenberg, when asked by the script enter the commit hash to be cherry-picked.

### Release checklist template differences

1. Include `Betafix` in the heading.
1. `after_X.XX.X` branches can be ignored.

## 4. Hotfix

### When

A fix is targeting a main app version that is already released and a new gutenberg-mobile release is needed.

### Branches

For example when releasing gutenberg-mobile `1.11.1` while main apps version `22.2.0` is released which currently has gutenberg-mobile `1.11.0` in it.
At the same time there could also be a regular release, a betafix or even another hotfix going on for example for gutenberg-mobile version `1.12.1`.

| Repo | Cut From | Branch Name | Merging To |
| ---------------- | ----------------------- | ---------------------------------- | ---------------------------------------------------------------- |
| gutenberg | rnmobile/release_1.11.0 (tag) | rnmobile/release_1.11.1 | trunk & (maybe also) rnmobile/release_1.12.1 |
| gutenberg-mobile | v1.11.0 (tag) | release/1.11.1 | trunk & (maybe also) release/1.12.1 |
| WPAndroid | release/22.2.0 | gutenberg/integrate_release_1.11.1 | release/22.2.1 & (maybe also) gutenberg/integrate_release_1.12.1 |
| WPiOS | release/22.2.0 | gutenberg/integrate_release_1.11.1 | release/22.2.1 & (maybe also) gutenberg/integrate_release_1.12.1 |

### Automation script differences

1. If necessary create new patch version branches `release/X.Y.1` in WPiOS and WPAndroid.

The rest should be same the as Betafix.

### Release checklist template differences

1. Include `Hotfix` in the heading
1. After the fix is merged and if there is an ongoing regular release, betafix or hotfix then the changes should be brought back to those branches as well.

The rest should be same the as Betafix.
30 changes: 30 additions & 0 deletions gbm-cli/Testing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Testing

If developing with VSCode, tests can be run inline within the test files themselves, and is the recommended method for running and debugging tests. Tests can also be run from the command line with the `go test` command.

## Testing Environment for Development
The CLI tool can be run against forked repos for testing. To configure your forked repos:

1. Fork the following repos to your github user repo:
- [Gutenberg-Mobile](https://github.com/wordpress-mobile/gutenberg-mobile)
- [Gutenberg](https://github.com/WordPress/gutenberg)
- [WordPress-Android](https://github.com/wordpress-mobile/WordPress-Android)
- [WordPress-iOS](https://github.com/wordpress-mobile/WordPress-iOS)

3. Ensure that your forked repos contains the PR labels specified below:
a) Gutenberg Mobile: "release-process"
b) Gutenberg: "Mobile App - i.e. Android or iOS"

4. Ensure that each of your repos contains the target branch `trunk`.

5. Ensure that [.gitmodules](https://github.com/wordpress-mobile/gutenberg-mobile/blob/trunk/.gitmodules) references your Gutenberg fork.


To run commands against the forked repos, set `GBM_WORDPRESS_ORG` and `GBM_WPMOBILE_ORG` as environment variables to user GitHub username. By default, these values with be WordPress and WordPress-Mobile, respectively.

Example command:

```
GBM_WPMOBILE_ORG=yourusername GBM_WORDPRESS_ORG=yourusername go run main.go release prepare gb 1.109.0
```

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (
"path/filepath"

"github.com/spf13/cobra"
"github.com/wordpress-mobile/gbm-cli/cmd/utils"
wp "github.com/wordpress-mobile/gbm-cli/cmd/workspace"
"github.com/wordpress-mobile/gbm-cli/pkg/console"
"github.com/wordpress-mobile/gbm-cli/pkg/gh"
"github.com/wordpress-mobile/gbm-cli/pkg/release"
"github.com/wordpress-mobile/gbm-cli/pkg/release/integrate"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/cmd/utils"
wp "github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/cmd/workspace"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/console"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/gh"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/release"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/release/integrate"
)

var android, ios, both bool
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"path/filepath"

"github.com/spf13/cobra"
"github.com/wordpress-mobile/gbm-cli/pkg/console"
"github.com/wordpress-mobile/gbm-cli/pkg/gh"
"github.com/wordpress-mobile/gbm-cli/pkg/release"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/console"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/gh"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/release"
)

var allCmd = &cobra.Command{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package prepare

import (
"github.com/spf13/cobra"
"github.com/wordpress-mobile/gbm-cli/pkg/console"
"github.com/wordpress-mobile/gbm-cli/pkg/gh"
"github.com/wordpress-mobile/gbm-cli/pkg/release"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/console"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/gh"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/release"
)

var gbCmd = &cobra.Command{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package prepare

import (
"github.com/spf13/cobra"
"github.com/wordpress-mobile/gbm-cli/pkg/console"
"github.com/wordpress-mobile/gbm-cli/pkg/gh"
"github.com/wordpress-mobile/gbm-cli/pkg/release"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/console"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/gh"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/release"
)

var gbmCmd = &cobra.Command{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"errors"

"github.com/spf13/cobra"
"github.com/wordpress-mobile/gbm-cli/cmd/utils"
wp "github.com/wordpress-mobile/gbm-cli/cmd/workspace"
"github.com/wordpress-mobile/gbm-cli/pkg/console"
"github.com/wordpress-mobile/gbm-cli/pkg/gbm"
"github.com/wordpress-mobile/gbm-cli/pkg/gh"
"github.com/wordpress-mobile/gbm-cli/pkg/release"
"github.com/wordpress-mobile/gbm-cli/pkg/semver"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/cmd/utils"
wp "github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/cmd/workspace"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/console"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/gbm"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/gh"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/release"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/semver"
)

var exitIfError func(error, int)
Expand Down
4 changes: 2 additions & 2 deletions cli/cmd/release/root.go → gbm-cli/cmd/release/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package release

import (
"github.com/spf13/cobra"
"github.com/wordpress-mobile/gbm-cli/cmd/release/prepare"
wp "github.com/wordpress-mobile/gbm-cli/cmd/workspace"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/cmd/release/prepare"
wp "github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/cmd/workspace"
)

var exitIfError func(error, int)
Expand Down
12 changes: 6 additions & 6 deletions cli/cmd/release/status.go → gbm-cli/cmd/release/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package release
import (
"github.com/fatih/color"
"github.com/spf13/cobra"
"github.com/wordpress-mobile/gbm-cli/cmd/utils"
"github.com/wordpress-mobile/gbm-cli/pkg/console"
"github.com/wordpress-mobile/gbm-cli/pkg/gbm"
"github.com/wordpress-mobile/gbm-cli/pkg/gh"
"github.com/wordpress-mobile/gbm-cli/pkg/release"
"github.com/wordpress-mobile/gbm-cli/pkg/repo"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/cmd/utils"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/console"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/gbm"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/gh"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/release"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/repo"
)

var StatusCmd = &cobra.Command{
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion cli/cmd/render/aztec.go → gbm-cli/cmd/render/aztec.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package render

import (
"github.com/spf13/cobra"
"github.com/wordpress-mobile/gbm-cli/pkg/console"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/console"
)

var AztecCmd = &cobra.Command{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (

"github.com/spf13/cobra"

"github.com/wordpress-mobile/gbm-cli/pkg/console"
"github.com/wordpress-mobile/gbm-cli/pkg/gbm"
"github.com/wordpress-mobile/gbm-cli/pkg/render"
"github.com/wordpress-mobile/gbm-cli/pkg/semver"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/console"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/gbm"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/render"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/semver"
)

var version string
Expand Down Expand Up @@ -70,6 +70,7 @@ var ChecklistCmd = &cobra.Command{
Scheduled: scheduled,
ReleaseUrl: releaseUrl,
Date: releaseDate,
Message: message,
HostVersion: hostVersion,
IncludeAztec: includeAztec,
CheckAztec: checkAztec,
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/render/root.go → gbm-cli/cmd/render/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"os"

"github.com/spf13/cobra"
"github.com/wordpress-mobile/gbm-cli/cmd/utils"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/cmd/utils"
)

var writeToClipboard bool
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/render/utils.go → gbm-cli/cmd/render/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"time"

"github.com/wordpress-mobile/gbm-cli/pkg/render"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/render"
)

func renderAztecSteps(conditional bool) (string, error) {
Expand Down
6 changes: 3 additions & 3 deletions cli/cmd/root.go → gbm-cli/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package cmd

import (
"github.com/spf13/cobra"
"github.com/wordpress-mobile/gbm-cli/cmd/release"
"github.com/wordpress-mobile/gbm-cli/cmd/render"
"github.com/wordpress-mobile/gbm-cli/pkg/console"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/cmd/release"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/cmd/render"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/console"
)

// rootCmd represents the base command when called without any subcommands
Expand Down
4 changes: 2 additions & 2 deletions cli/cmd/utils/utils.go → gbm-cli/cmd/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"os"

"github.com/wordpress-mobile/gbm-cli/pkg/console"
"github.com/wordpress-mobile/gbm-cli/pkg/semver"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/console"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/semver"
)

func GetVersionArg(args []string) (semver.SemVer, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os/signal"
"path"

"github.com/wordpress-mobile/gbm-cli/pkg/console"
"github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/gbm-cli/pkg/console"
)

type Workspace interface {
Expand Down
Loading

0 comments on commit e5e137c

Please sign in to comment.