fastlane-plugin-wpmreleasetoolkit 12.2.0 → 12.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5efb1f6f88d1bb1617313112768ef93497cabe3897bb4834c5026a4e9a68ced0
4
- data.tar.gz: 8eaef85d47b2ec7be3e2da0693856923c02e6f67b65707e4143d7241147a7435
3
+ metadata.gz: 24ece3855d069cb67f8e0a3eca97e11f14af1361ce2c00084289a21b23b99b10
4
+ data.tar.gz: 7fda68ae30e60082db9276f89649dcea58d279be623f1ecd6ea96eddf47394cc
5
5
  SHA512:
6
- metadata.gz: 7c05b2af7ca941a5afb52b703f3f0ee315e0ab48ffa87de88c48c5f22bbc1db82f0a819c7e4f2b10e754b6558569d801431e64b00f491e282eadd9885c4f75ac
7
- data.tar.gz: fc832aaf5f31e2e6b3f51c268f38529f056dc40a0971fb67e962da313634e2c56580eeac23f8d2e94f2f3dcc74ad3d69b0a465724afb7c178501103a5c01d309
6
+ metadata.gz: 351386b21f54221ebd0b821caaa9bf1b3a2584c4d14d292e4d5a607ab1ef421443df685d25c464da00dc9a6d5abe7b4934a670afa092b9a04776f504f457eba6
7
+ data.tar.gz: 5ac9f250c4baef6cab62e214b94ead03fd6ecd5c5618a37f62ed230963c34c7d04951db78b3382e4d0abfa8510d1a571e8a12ca8d0df42d814d5cbe9a51c7679
data/README.md CHANGED
@@ -24,15 +24,17 @@ This guide also includes some tips about configuring your environment and IDE (e
24
24
 
25
25
  When you need to do a new release of the `release-toolkit`, simply run `rake new_release` and follow the instructions.
26
26
 
27
+ > [!NOTE]
27
28
  > This task will:
28
29
  > - Show you the CHANGELOG/release notes it's about to use for that version
29
30
  > - Deduce which version number to use according to [SemVer](https://semver.org/) rules, and ask you to confirm that version number
30
31
  > - Create a `release/<x.y>` branch, update the version number in all the right places, and create a PR for those changes
31
32
 
32
- Submit the PR, adding the `Releases` label to it and adding the `owl-team` as reviewers.
33
+ Submit the PR, adding the `Releases` label to it and adding the `@wordpress-mobile/apps-infrastructure` team as reviewers.
33
34
 
34
35
  Once that PR is approved and merged, create a new GitHub Release, copy/pasting the CHANGELOG entries for that GH release's description.
35
36
 
37
+ > [!IMPORTANT]
36
38
  > Publishing the GitHub Release will create the associated tag as well, which will trigger the CI job that will ultimately `gem push` the gem on RubyGems.
37
39
 
38
40
  ## Security
@@ -50,4 +52,4 @@ If you have questions about getting setup or just want to say hi, join the [Word
50
52
 
51
53
  ## License
52
54
 
53
- Mobile Release Toolkit is an Open Source project covered by the [GNU General Public License version 2](LICENSE).
55
+ Mobile Release Toolkit is an Open Source project covered by the [GNU General Public License version 2](LICENSE).
@@ -92,10 +92,11 @@ module Fastlane
92
92
  intermediate_branch = "merge/#{head_branch.gsub('/', '-')}-into-#{base_branch.gsub('/', '-')}"
93
93
 
94
94
  if Fastlane::Helper::GitHelper.branch_exists_on_remote?(branch_name: intermediate_branch)
95
- UI.user_error!("The intermediate branch `#{intermediate_branch}` already exists. Please check if there is an existing Pull Request that needs to be merged or closed first, or delete the branch.")
96
- return nil
95
+ UI.important("An intermediate branch `#{intermediate_branch}` already exists on the remote. It will be deleted and GitHub will close any associated existing PR.")
96
+ Fastlane::Helper::GitHelper.delete_remote_branch_if_exists!(intermediate_branch)
97
97
  end
98
98
 
99
+ Fastlane::Helper::GitHelper.delete_local_branch_if_exists!(intermediate_branch)
99
100
  Fastlane::Helper::GitHelper.create_branch(intermediate_branch)
100
101
 
101
102
  intermediate_branch_created_callback&.call(base_branch, intermediate_branch)
@@ -232,6 +232,32 @@ module Fastlane
232
232
  !Action.sh('git', 'ls-remote', '--heads', remote_name, branch_name).empty?
233
233
  end
234
234
 
235
+ # Delete a local branch if it exists.
236
+ #
237
+ # @param [String] branch_name The name of the local branch to delete.
238
+ # @return [Boolean] true if the branch was deleted, false if not (e.g. no such local branch existed in the first place)
239
+ #
240
+ def self.delete_local_branch_if_exists!(branch_name)
241
+ git_repo = Git.open(Dir.pwd)
242
+ return false unless git_repo.is_local_branch?(branch_name)
243
+
244
+ git_repo.branch(branch_name).delete
245
+ true
246
+ end
247
+
248
+ # Delete a remote branch if it exists.
249
+ #
250
+ # @param [String] branch_name The name of the remote branch to delete.
251
+ # @param [String] remote_name The name of the remote to delete the branch from. Defaults to 'origin'
252
+ # @return [Boolean] true if the branch was deleted, false if not (e.g. no such local branch existed in the first place)
253
+ #
254
+ def self.delete_remote_branch_if_exists!(branch_name, remote_name: 'origin')
255
+ git_repo = Git.open(Dir.pwd)
256
+ return false unless git_repo.branches.any? { |b| b.remote&.name == remote_name && b.name == branch_name }
257
+
258
+ git_repo.push(remote_name, branch_name, delete: true)
259
+ end
260
+
235
261
  # Checks whether a given path is ignored by Git, relying on Git's `check-ignore` under the hood.
236
262
  #
237
263
  # @param [String] path The path to check against `.gitignore`
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Fastlane
4
4
  module Wpmreleasetoolkit
5
- VERSION = '12.2.0'
5
+ VERSION = '12.2.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-wpmreleasetoolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.2.0
4
+ version: 12.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Automattic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-30 00:00:00.000000000 Z
11
+ date: 2024-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport