fastlane-plugin-wpmreleasetoolkit 12.1.0 → 12.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b71377d7f0e796edf717a11ca452dd7c155106e8950500a183b59284649741cd
4
- data.tar.gz: f948046099b8a967323e81aa409ccd806cbe6fc5d87a0a5624e0800055638511
3
+ metadata.gz: 24ece3855d069cb67f8e0a3eca97e11f14af1361ce2c00084289a21b23b99b10
4
+ data.tar.gz: 7fda68ae30e60082db9276f89649dcea58d279be623f1ecd6ea96eddf47394cc
5
5
  SHA512:
6
- metadata.gz: 4431300d4963531af3f7c001a1f9b321ba1cdb8720721f9293046dccc07588b7a4bf5b00fa812623ddeb6e38e8a6f61fca84061f793fd9fc13ba46c6e4671d00
7
- data.tar.gz: 39da07fb31ddad66c5a8140b1ef35e1150607d8761dae047e56bae804b90e618ece0f6a04bdff3c3e92ee2c3e5f68acf1072cf90602e67dc3ec71a9ffc3620fc
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).
@@ -0,0 +1,63 @@
1
+ module Fastlane
2
+ module Actions
3
+ class BuildkitePipelineUploadAction < Action
4
+ DEFAULT_ENV_FILE = File.join('.buildkite', 'shared-pipeline-vars').freeze
5
+
6
+ def self.run(params)
7
+ pipeline_file = params[:pipeline_file]
8
+ env_file = params[:env_file]
9
+ environment = params[:environment]
10
+
11
+ UI.user_error!("Pipeline file not found: #{pipeline_file}") unless File.exist?(pipeline_file)
12
+ UI.user_error!('This action can only be called from a Buildkite CI build') unless ENV['BUILDKITE'] == 'true'
13
+
14
+ UI.message "Adding steps from `#{pipeline_file}` to the current build"
15
+
16
+ if env_file && File.exist?(env_file)
17
+ UI.message(" - Sourcing environment file beforehand: #{env_file}")
18
+
19
+ sh(environment, "source #{env_file.shellescape} && buildkite-agent pipeline upload #{pipeline_file.shellescape}")
20
+ else
21
+ sh(environment, 'buildkite-agent', 'pipeline', 'upload', pipeline_file)
22
+ end
23
+ end
24
+
25
+ def self.description
26
+ # https://buildkite.com/docs/agent/v3/cli-pipeline#uploading-pipelines
27
+ 'Uploads a pipeline to Buildkite, adding all its steps to the current build'
28
+ end
29
+
30
+ def self.available_options
31
+ [
32
+ FastlaneCore::ConfigItem.new(
33
+ key: :pipeline_file,
34
+ description: 'The path to the YAML pipeline file to upload',
35
+ optional: false,
36
+ type: String
37
+ ),
38
+ FastlaneCore::ConfigItem.new(
39
+ key: :env_file,
40
+ description: 'The path to a bash file to be sourced before uploading the pipeline',
41
+ optional: true,
42
+ default_value: DEFAULT_ENV_FILE,
43
+ type: String
44
+ ),
45
+ FastlaneCore::ConfigItem.new(
46
+ key: :environment,
47
+ description: 'Environment variables to load when running `pipeline upload`, to allow for variable substitution in the YAML pipeline',
48
+ type: Hash,
49
+ default_value: {}
50
+ ),
51
+ ]
52
+ end
53
+
54
+ def self.authors
55
+ ['Automattic']
56
+ end
57
+
58
+ def self.is_supported?(platform)
59
+ true
60
+ end
61
+ end
62
+ end
63
+ end
@@ -58,7 +58,7 @@ module Fastlane
58
58
  ),
59
59
  FastlaneCore::ConfigItem.new(
60
60
  key: :buildkite_organization,
61
- env_name: 'BUILDKITE_ORGANIZTION',
61
+ env_name: 'BUILDKITE_ORGANIZATION',
62
62
  description: 'The Buildkite organization that contains your pipeline',
63
63
  type: String
64
64
  ),
@@ -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.1.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.1.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-12 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
@@ -406,6 +406,7 @@ files:
406
406
  - lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_release_notes.rb
407
407
  - lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_annotate_action.rb
408
408
  - lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_metadata_action.rb
409
+ - lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_pipeline_upload_action.rb
409
410
  - lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_trigger_build_action.rb
410
411
  - lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_for_toolkit_updates_action.rb
411
412
  - lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_translation_progress.rb