Skip to content

Commit 062d868

Browse files
authored
Merge pull request #319 from wordpress-mobile/set/default-branch-to-trunk
Update default branch to trunk
2 parents 31187cf + 28c3a7a commit 062d868

12 files changed

+85
-44
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ _None_
2727
* Added a new `ios_generate_strings_file_from_code` action to replace the now-deprecated `ios_localize_project` action (and `Scripts/localize.py` script in app repos). [#309, #311]
2828
* Added a `comment_on_pr` action to allow commenting on (and updating comments on) PRs. [#313]
2929
* Added the ability to use the `GITHUB_TOKEN` environment variable for GitHub operations. `GHHELPER_ACCESS` will be deprecated in a future version. [#313]
30-
* Added support for downloading GitHub content for private repositories
30+
* Added support for downloading GitHub content for private repositories [#321]
31+
* Added parameter for default/base branch across several actions [#319]
3132

3233
### Bug Fixes
3334

Rakefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ task :new_release do
7474
Console.header 'Commit and push changes...'
7575
GitHelper.commit_files("Bumped to version #{new_version}", [VERSION_FILE, 'Gemfile.lock', 'CHANGELOG.md'])
7676

77-
Console.header 'Opening PR drafts in your default browser...'
78-
GitHelper.prepare_github_pr("release/#{new_version}", 'develop', "Release #{new_version} into develop", "New version #{new_version}")
77+
Console.header 'Opening PR draft in your default browser...'
7978
GitHelper.prepare_github_pr("release/#{new_version}", 'trunk', "Release #{new_version} into trunk", "New version #{new_version}. Be sure to create a GitHub Release and tag once this PR gets merged.")
8079

8180
Console.info <<~INSTRUCTIONS
@@ -84,8 +83,8 @@ task :new_release do
8483
8584
>>> WHAT'S NEXT
8685
87-
1. Create PRs to `develop` and `trunk`.
88-
2. Once the PRs are merged, publish a GitHub release for \`#{new_version}\`, targeting \`trunk\`,
86+
1. Create a PR against `trunk`.
87+
2. Once the PR is merged, publish a GitHub release for \`#{new_version}\`, targeting \`trunk\`,
8988
creating a new \`#{new_version} tag in the process.
9089
9190
The creation of the new tag will trigger a CI workflow that will take care of doing the

docs/screenshot-compositor.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ This argument is a path to the directory containing the screenshots, typically g
2323

2424
**`metadata_folder`**
2525

26-
This argument is a path to the directory containing any metadata, such as localized strings for use on the final screenshots. This directory should contain subdirectories named after locales.
26+
This argument is a path to the directory containing any metadata, such as localized strings for use on the final screenshots. This directory should contain subdirectories named after locales.
2727

2828
> Note: The tool will automatically check these directories, and will be default use any locales found in both directories.
2929
@@ -43,7 +43,7 @@ The tool uses a `.json` file for configuration. By default, the tool will attemp
4343

4444
The following sample implementations provide a good example of how to create a configuration file:
4545

46-
- [WordPress Android](https://github.com/wordpress-mobile/WordPress-Android/blob/develop/fastlane/screenshots.json)
46+
- [WordPress Android](https://github.com/wordpress-mobile/WordPress-Android/blob/trunk/fastlane/screenshots.json)
4747

4848
## Creating a configuration file
4949

@@ -160,7 +160,7 @@ Entries specify the set of output screenshots. This takes the form of an array o
160160

161161
> Note: There is a 1:1 relationship between entries and the final screenshots. Note that it is not necessary to create a set of entries for each locale – this is automatically handled for you.
162162
163-
Each entry looks something like this:
163+
Each entry looks something like this:
164164

165165
```json
166166
{
@@ -251,19 +251,19 @@ Specifies a list of attachments, which can be images or text. They are composite
251251
```
252252
Text attachments use the following keys:
253253

254-
**`text`**
254+
**`text`**
255255

256256
Specifies the path to the text file for this attachment. The path should be specified relative to the configuration file, and can contain the `{locale}` placeholder to allow for localization.
257257

258-
**`size`**
258+
**`size`**
259259

260-
Sets the dimensions of the text bounding box within the final image. This must be provided as an array with two values corresponding to the width and height, respectively. If the size is too small, the compositor will crash saying it was unable to draw the text in an area this small. The text will be horizontally and vertically centered within the bounding box.
260+
Sets the dimensions of the text bounding box within the final image. This must be provided as an array with two values corresponding to the width and height, respectively. If the size is too small, the compositor will crash saying it was unable to draw the text in an area this small. The text will be horizontally and vertically centered within the bounding box.
261261

262-
**`position`**
262+
**`position`**
263263

264264
Sets the origin of the text bounding box within the final image. This must be provided as an array with two values corresponding to the x and y coordinates, respectively.
265265

266-
**`font-size`**
266+
**`font-size`**
267267

268268
Specifies the font size for the text of this attachment. If this number is too large, such that it doesn't fit into the bounding box described by the `size` key, the compositor will exit with an error message.
269269

@@ -282,19 +282,19 @@ Specifies a stylesheet used for this attachment. It should contain a path to the
282282

283283
Image attachments use the following keys:
284284

285-
**`file`**
285+
**`file`**
286286

287287
Specifies the path to the attachment image. The path should be specified relative to the configuration file, and can contain the `{locale}` placeholder to allow for localization.
288288

289-
**`size`**
289+
**`size`**
290290

291291
Sets the dimensions of the attachment within the final image. This must be provided as an array with two values corresponding to the width and height, respectively.
292292

293-
**`position`**
293+
**`position`**
294294

295295
Sets the origin of the attachment within the final image. This must be provided as an array with two values corresponding to the x and y coordinates, respectively.
296296

297-
**`operations`**
297+
**`operations`**
298298

299299
Specifies a set of operations to perform on the attachment prior to drawing it to the canvas. Operations run in the order they're specified within the configuration file. Operations are defined as an array of hashes. For example:
300300

@@ -308,18 +308,18 @@ Specifies a set of operations to perform on the attachment prior to drawing it t
308308

309309
They use the following keys:
310310

311-
**`type`**
311+
**`type`**
312312

313313
Describes the type of operation. Currently `crop` is the only operation that can be specified.
314314

315315
**Operations**
316316

317317
*Crop* allows you to crop the image using two keys:
318318

319-
**`at`**
319+
**`at`**
320320

321321
Specifies the origin point crop bounding box. This must be provided as an array with two values corresponding to the x and y coordinates, respectively.
322322

323-
**`to`**
323+
**`to`**
324324

325325
Specifies the dimensions of the crop bounding box. This must be provided as an array with two values corresponding to the width and height, respectively.

lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ def self.run(params)
88
require_relative '../../helper/android/android_version_helper'
99
require_relative '../../helper/android/android_git_helper'
1010

11-
# Checkout develop and update
12-
Fastlane::Helper::GitHelper.checkout_and_pull('develop')
11+
# Checkout default branch and update
12+
default_branch = params[:default_branch]
13+
Fastlane::Helper::GitHelper.checkout_and_pull(default_branch)
1314

1415
# Check versions
1516
release_version = Fastlane::Helper::Android::VersionHelper.get_release_version
@@ -80,6 +81,11 @@ def self.available_options
8081
description: 'Skips confirmation',
8182
is_string: false, # true: verifies the input is a string, false: every kind of value
8283
default_value: false), # the default value if the user didn't provide one
84+
FastlaneCore::ConfigItem.new(key: :default_branch,
85+
env_name: 'FL_RELEASE_TOOLKIT_DEFAULT_BRANCH',
86+
description: 'Default branch of the repository',
87+
type: String,
88+
default_value: Fastlane::Helper::GitHelper::DEFAULT_GIT_BRANCH),
8389
]
8490
end
8591

lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_release.rb

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ def self.run(params)
88
require_relative '../../helper/android/android_version_helper'
99
require_relative '../../helper/android/android_git_helper'
1010

11-
other_action.ensure_git_branch(branch: 'develop')
11+
default_branch = params[:default_branch]
12+
other_action.ensure_git_branch(branch: default_branch)
1213

1314
# Create new configuration
1415
new_short_version = Fastlane::Helper::Android::VersionHelper.bump_version_release
@@ -28,9 +29,9 @@ def self.run(params)
2829
UI.message("New version: #{new_short_version}")
2930
UI.message("Release branch: #{new_release_branch}")
3031

31-
# Update local develop and branch
32+
# Update local default branch and create branch from it
3233
UI.message 'Creating new branch...'
33-
Fastlane::Helper::GitHelper.create_branch(new_release_branch, from: 'develop')
34+
Fastlane::Helper::GitHelper.create_branch(new_release_branch, from: default_branch)
3435
UI.message 'Done!'
3536

3637
UI.message 'Updating app version...'
@@ -52,7 +53,13 @@ def self.details
5253
end
5354

5455
def self.available_options
55-
# Define all options your action supports.
56+
[
57+
FastlaneCore::ConfigItem.new(key: :default_branch,
58+
env_name: 'FL_RELEASE_TOOLKIT_DEFAULT_BRANCH',
59+
description: 'Default branch of the repository',
60+
type: String,
61+
default_value: Fastlane::Helper::GitHelper::DEFAULT_GIT_BRANCH),
62+
]
5663
end
5764

5865
def self.output

lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_codefreeze_prechecks.rb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ def self.run(params)
1111
require_relative '../../helper/android/android_version_helper'
1212
require_relative '../../helper/android/android_git_helper'
1313

14-
# Checkout develop and update
15-
Fastlane::Helper::GitHelper.checkout_and_pull('develop')
14+
# Checkout default branch and update
15+
default_branch = params[:default_branch]
16+
Fastlane::Helper::GitHelper.checkout_and_pull(default_branch)
1617

1718
# Create versions
1819
current_version = Fastlane::Helper::Android::VersionHelper.get_release_version
@@ -23,7 +24,7 @@ def self.run(params)
2324
no_alpha_version_message = "No alpha version configured. If you wish to configure an alpha version please update version.properties to include an alpha key for this app\n"
2425
# Ask user confirmation
2526
unless params[:skip_confirm]
26-
confirm_message = "Building a new release branch starting from develop.\nCurrent version is #{current_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]} (#{current_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}).\n"
27+
confirm_message = "Building a new release branch starting from #{default_branch}.\nCurrent version is #{current_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]} (#{current_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}).\n"
2728
confirm_message += current_alpha_version.nil? ? no_alpha_version_message : "Current Alpha version is #{current_alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]} (#{current_alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}).\n"
2829
confirm_message += "After codefreeze the new version will be: #{next_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]} (#{next_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}).\n"
2930
confirm_message += current_alpha_version.nil? ? '' : "After codefreeze the new Alpha will be: #{next_alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]} (#{next_alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}).\n"
@@ -47,7 +48,7 @@ def self.description
4748
end
4849

4950
def self.details
50-
'Updates the develop branch, checks the app version and ensure the branch is clean'
51+
'Updates the default branch, checks the app version and ensure the branch is clean'
5152
end
5253

5354
def self.available_options
@@ -58,6 +59,11 @@ def self.available_options
5859
description: 'Skips confirmation before codefreeze',
5960
is_string: false, # true: verifies the input is a string, false: every kind of value
6061
default_value: false), # the default value if the user didn't provide one
62+
FastlaneCore::ConfigItem.new(key: :default_branch,
63+
env_name: 'FL_RELEASE_TOOLKIT_DEFAULT_BRANCH',
64+
description: 'Default branch of the repository',
65+
type: String,
66+
default_value: Fastlane::Helper::GitHelper::DEFAULT_GIT_BRANCH),
6167
]
6268
end
6369

lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_betabuild_prechecks.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ def self.run(params)
88
require_relative '../../helper/ios/ios_version_helper'
99
require_relative '../../helper/ios/ios_git_helper'
1010

11-
# Checkout develop and update
12-
Fastlane::Helper::GitHelper.checkout_and_pull('develop')
11+
# Checkout default branch and update
12+
default_branch = params[:default_branch]
13+
Fastlane::Helper::GitHelper.checkout_and_pull(default_branch)
1314

1415
# Check versions
1516
build_version = Fastlane::Helper::Ios::VersionHelper.get_build_version
@@ -69,6 +70,11 @@ def self.available_options
6970
description: 'Skips confirmation',
7071
is_string: false, # true: verifies the input is a string, false: every kind of value
7172
default_value: false), # the default value if the user didn't provide one
73+
FastlaneCore::ConfigItem.new(key: :default_branch,
74+
env_name: 'FL_RELEASE_TOOLKIT_DEFAULT_BRANCH',
75+
description: 'Default branch of the repository',
76+
type: String,
77+
default_value: Fastlane::Helper::GitHelper::DEFAULT_GIT_BRANCH),
7278
]
7379
end
7480

lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@ def self.run(params)
88
require_relative '../../helper/ios/ios_version_helper'
99
require_relative '../../helper/ios/ios_git_helper'
1010

11-
other_action.ensure_git_branch(branch: 'develop')
11+
default_branch = params[:default_branch]
12+
other_action.ensure_git_branch(branch: default_branch)
1213

1314
# Create new configuration
1415
@new_version = Fastlane::Helper::Ios::VersionHelper.bump_version_release()
1516
create_config()
1617
show_config()
1718

18-
# Update local develop and branch
19-
Fastlane::Helper::GitHelper.checkout_and_pull('develop')
20-
Fastlane::Helper::GitHelper.create_branch(@new_release_branch, from: 'develop')
19+
# Update local default branch and create branch from it
20+
Fastlane::Helper::GitHelper.checkout_and_pull(default_branch)
21+
Fastlane::Helper::GitHelper.create_branch(@new_release_branch, from: default_branch)
2122
UI.message 'Done!'
2223

2324
UI.message 'Updating glotPressKeys...' unless params[:skip_glotpress]
@@ -64,7 +65,11 @@ def self.available_options
6465
description: 'Skips Deliver key update',
6566
is_string: false, # true: verifies the input is a string, false: every kind of value
6667
default_value: false), # the default value if the user didn't provide one
67-
68+
FastlaneCore::ConfigItem.new(key: :default_branch,
69+
env_name: 'FL_RELEASE_TOOLKIT_DEFAULT_BRANCH',
70+
description: 'Default branch of the repository',
71+
type: String,
72+
default_value: Fastlane::Helper::GitHelper::DEFAULT_GIT_BRANCH),
6873
]
6974
end
7075

lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_codefreeze_prechecks.rb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@ def self.run(params)
88
require_relative '../../helper/ios/ios_version_helper'
99
require_relative '../../helper/ios/ios_git_helper'
1010

11-
# Checkout develop and update
12-
Fastlane::Helper::GitHelper.checkout_and_pull('develop')
11+
# Checkout default branch and update
12+
default_branch = params[:default_branch]
13+
Fastlane::Helper::GitHelper.checkout_and_pull(default_branch)
1314

1415
# Create versions
1516
current_version = Fastlane::Helper::Ios::VersionHelper.get_public_version
1617
current_build_version = Fastlane::Helper::Ios::VersionHelper.get_build_version
1718
next_version = Fastlane::Helper::Ios::VersionHelper.calc_next_release_version(current_version)
1819

1920
# Ask user confirmation
20-
unless params[:skip_confirm] || UI.confirm("Building a new release branch starting from develop.\nCurrent version is #{current_version} (#{current_build_version}).\nAfter codefreeze the new version will be: #{next_version}.\nDo you want to continue?")
21+
unless params[:skip_confirm] || UI.confirm("Building a new release branch starting from #{default_branch}.\nCurrent version is #{current_version} (#{current_build_version}).\nAfter codefreeze the new version will be: #{next_version}.\nDo you want to continue?")
2122
UI.user_error!('Aborted by user request')
2223
end
2324

@@ -37,7 +38,7 @@ def self.description
3738
end
3839

3940
def self.details
40-
'Updates the develop branch, checks the app version and ensure the branch is clean'
41+
'Updates the default branch, checks the app version and ensure the branch is clean'
4142
end
4243

4344
def self.available_options
@@ -48,6 +49,11 @@ def self.available_options
4849
description: 'Skips confirmation before codefreeze',
4950
is_string: false, # true: verifies the input is a string, false: every kind of value
5051
default_value: false), # the default value if the user didn't provide one
52+
FastlaneCore::ConfigItem.new(key: :default_branch,
53+
env_name: 'FL_RELEASE_TOOLKIT_DEFAULT_BRANCH',
54+
description: 'Default branch of the repository',
55+
type: String,
56+
default_value: Fastlane::Helper::GitHelper::DEFAULT_GIT_BRANCH),
5157
]
5258
end
5359

lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ module Helper
55
# Helper methods to execute git-related operations
66
#
77
module GitHelper
8+
# Fallback default branch of the client repository. It's currently set to 'develop' for
9+
# backwards compatibility.
10+
# TODO: Set to 'trunk' for the next major release.
11+
DEFAULT_GIT_BRANCH = 'develop'.freeze
12+
813
# Checks if the given path, or current directory if no path is given, is
914
# inside a Git repository
1015
#

0 commit comments

Comments
 (0)