fastlane-plugin-google_play_track_updater 0.1.0 → 0.2.0

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: 11eadb84667aef723c783a8dcffa26780b405708ff266657ddacc2a8d7f91d2f
4
- data.tar.gz: f680a23a1d846440ca71559f04d20636e0faeb95729471b700deaa879c16f3cd
3
+ metadata.gz: 3f6a463cee2241a21350c409d548431dbad04658b5b1315a1763253049f1ae56
4
+ data.tar.gz: c41532a0ea7524ced39870bd269176ae8e7ffa2bd4d1d8b401c3cfafff181f22
5
5
  SHA512:
6
- metadata.gz: '08cc54c3f46d2a9748e21a7de9eb83bfd024f5ad176b00f7144a38bdec1b9787982bc30b71d818dbe7a850ea14367c83abe7f2be46e6258854d12e6a54d200d8'
7
- data.tar.gz: defce589cb05520229a89060ca58073c2e7e59ec9ef1abaec5a332b9854b324f96969bdd22042d633ebd7a9c5b18451f051fbc2fea8adaec6473163d3c9505cf
6
+ metadata.gz: 7ed70ae73baff84086077776aa44c5b072c7f1d8b7c4eacf455c271fac6af25b7418b52e9def0c0322007cf4287bb7fe864e4d616d1d287a741b5b9d7e2dfdd4
7
+ data.tar.gz: 81311526a851da3beaccd5a689212918efcc2b997061371b23e9fcf30727900fd4ba9f12ff191097b39a2fb9f6114441710066bd7ff59a4a28aded18de72c4d4
data/README.md CHANGED
@@ -34,6 +34,16 @@ By using focused actions like `halt_google_play_release`, `resume_google_play_re
34
34
  - Reduce the risk of accidentally modifying other release properties
35
35
  - Simplify your CI/CD pipelines with purpose-built commands
36
36
 
37
+ ## Authentication
38
+
39
+ This plugin supports multiple authentication methods. The priority order is:
40
+
41
+ 1. **`GOOGLE_APPLICATION_CREDENTIALS` environment variable** (Highest priority)
42
+ 2. **`json_file_path` parameter**
43
+ 3. **`json_key_data` parameter**
44
+
45
+ If `GOOGLE_APPLICATION_CREDENTIALS` is set, it will be used regardless of whether `json_file_path` or `json_key_data` are provided. This makes it convenient to use with tools like `google-github-actions/auth` which automatically sets this environment variable.
46
+
37
47
  ## Actions
38
48
 
39
49
  ### halt_google_play_release
@@ -51,15 +61,15 @@ halt_google_play_release(
51
61
 
52
62
  **Parameters:**
53
63
 
54
- | Key | Description | Required | Type |
55
- |-----|-------------|----------|------|
56
- | `package_name` | The package name of the application (e.g., 'com.example.app') | Yes | String |
57
- | `track` | The track of the application (production, beta, alpha, internal) | Yes | String |
58
- | `version_name` | The version name to halt (e.g., '1.0.0') | Yes | String |
59
- | `json_file_path` | Path to a file containing service account or external account JSON | No* | String |
60
- | `json_key_data` | Service account or external account JSON data as a string | No* | String |
64
+ | Key | Environment Variable | Description | Required | Type |
65
+ |-----|---------------------|-------------|----------|------|
66
+ | `package_name` | `HALT_GOOGLE_PLAY_RELEASE_PACKAGE_NAME` | The package name of the application (e.g., 'com.example.app') | Yes | String |
67
+ | `track` | `HALT_GOOGLE_PLAY_RELEASE_TRACK` | The track of the application (production, beta, alpha, internal) | Yes | String |
68
+ | `version_name` | `HALT_GOOGLE_PLAY_RELEASE_VERSION_NAME` | The version name to halt (e.g., '1.0.0') | Yes | String |
69
+ | `json_file_path` | `HALT_GOOGLE_PLAY_RELEASE_JSON_FILE_PATH` | Path to a file containing service account or external account JSON | No* | String |
70
+ | `json_key_data` | `HALT_GOOGLE_PLAY_RELEASE_JSON_KEY_DATA` | Service account or external account JSON data as a string | No* | String |
61
71
 
62
- \* Either `json_file_path` or `json_key_data` must be provided
72
+ \* Either `json_file_path`, `json_key_data`, or `GOOGLE_APPLICATION_CREDENTIALS` environment variable must be provided
63
73
 
64
74
  ### resume_google_play_release
65
75
 
@@ -76,15 +86,15 @@ resume_google_play_release(
76
86
 
77
87
  **Parameters:**
78
88
 
79
- | Key | Description | Required | Type |
80
- |-----|-------------|----------|------|
81
- | `package_name` | The package name of the application (e.g., 'com.example.app') | Yes | String |
82
- | `track` | The track of the application (production, beta, alpha, internal) | Yes | String |
83
- | `version_name` | The version name to resume (e.g., '1.0.0') | Yes | String |
84
- | `json_file_path` | Path to a file containing service account or external account JSON | No* | String |
85
- | `json_key_data` | Service account or external account JSON data as a string | No* | String |
89
+ | Key | Environment Variable | Description | Required | Type |
90
+ |-----|---------------------|-------------|----------|------|
91
+ | `package_name` | `RESUME_GOOGLE_PLAY_RELEASE_PACKAGE_NAME` | The package name of the application (e.g., 'com.example.app') | Yes | String |
92
+ | `track` | `RESUME_GOOGLE_PLAY_RELEASE_TRACK` | The track of the application (production, beta, alpha, internal) | Yes | String |
93
+ | `version_name` | `RESUME_GOOGLE_PLAY_RELEASE_VERSION_NAME` | The version name to resume (e.g., '1.0.0') | Yes | String |
94
+ | `json_file_path` | `RESUME_GOOGLE_PLAY_RELEASE_JSON_FILE_PATH` | Path to a file containing service account or external account JSON | No* | String |
95
+ | `json_key_data` | `RESUME_GOOGLE_PLAY_RELEASE_JSON_KEY_DATA` | Service account or external account JSON data as a string | No* | String |
86
96
 
87
- \* Either `json_file_path` or `json_key_data` must be provided
97
+ \* Either `json_file_path`, `json_key_data`, or `GOOGLE_APPLICATION_CREDENTIALS` environment variable must be provided
88
98
 
89
99
  ### update_google_play_release_rollout
90
100
 
@@ -102,16 +112,16 @@ update_google_play_release_rollout(
102
112
 
103
113
  **Parameters:**
104
114
 
105
- | Key | Description | Required | Type |
106
- |-----|-------------|----------|------|
107
- | `package_name` | The package name of the application (e.g., 'com.example.app') | Yes | String |
108
- | `track` | The track of the application (production, beta, alpha, internal) | Yes | String |
109
- | `version_name` | The version name to update (e.g., '1.0.0') | Yes | String |
110
- | `user_fraction` | The rollout percentage as a fraction (0.0 to 1.0, exclusive). e.g., 0.1 for 10% rollout | Yes | Float |
111
- | `json_file_path` | Path to a file containing service account or external account JSON | No* | String |
112
- | `json_key_data` | Service account or external account JSON data as a string | No* | String |
115
+ | Key | Environment Variable | Description | Required | Type |
116
+ |-----|---------------------|-------------|----------|------|
117
+ | `package_name` | `UPDATE_GOOGLE_PLAY_RELEASE_ROLLOUT_PACKAGE_NAME` | The package name of the application (e.g., 'com.example.app') | Yes | String |
118
+ | `track` | `UPDATE_GOOGLE_PLAY_RELEASE_ROLLOUT_TRACK` | The track of the application (production, beta, alpha, internal) | Yes | String |
119
+ | `version_name` | `UPDATE_GOOGLE_PLAY_RELEASE_ROLLOUT_VERSION_NAME` | The version name to update (e.g., '1.0.0') | Yes | String |
120
+ | `user_fraction` | `UPDATE_GOOGLE_PLAY_RELEASE_ROLLOUT_USER_FRACTION` | The rollout percentage as a fraction (0.0 to 1.0, exclusive). e.g., 0.1 for 10% rollout | Yes | Float |
121
+ | `json_file_path` | `UPDATE_GOOGLE_PLAY_RELEASE_ROLLOUT_JSON_FILE_PATH` | Path to a file containing service account or external account JSON | No* | String |
122
+ | `json_key_data` | `UPDATE_GOOGLE_PLAY_RELEASE_ROLLOUT_JSON_KEY_DATA` | Service account or external account JSON data as a string | No* | String |
113
123
 
114
- \* Either `json_file_path` or `json_key_data` must be provided
124
+ \* Either `json_file_path`, `json_key_data`, or `GOOGLE_APPLICATION_CREDENTIALS` environment variable must be provided
115
125
 
116
126
  ## Example
117
127
 
@@ -147,6 +157,68 @@ lane :update_rollout do
147
157
  end
148
158
  ```
149
159
 
160
+ ### Using with GitHub Actions and Workload Identity Provider
161
+
162
+ Since fastlane 2.230.0, you can use Workload Identity Provider for keyless authentication with Google Cloud. Here's an example workflow:
163
+
164
+ ```yaml
165
+ name: Halt Release
166
+
167
+ on:
168
+ workflow_dispatch:
169
+ inputs:
170
+ version_name:
171
+ description: 'Version name to halt (e.g., 1.0.0)'
172
+ required: true
173
+ type: string
174
+
175
+ jobs:
176
+ halt_release:
177
+ runs-on: ubuntu-latest
178
+ permissions:
179
+ contents: read
180
+ id-token: write
181
+ steps:
182
+ - uses: actions/checkout@v6
183
+
184
+ - name: Set up Ruby
185
+ uses: ruby/setup-ruby@v1
186
+ with:
187
+ ruby-version: '3.4'
188
+ bundler-cache: true
189
+
190
+ - id: auth
191
+ uses: google-github-actions/auth@v3
192
+ with:
193
+ create_credentials_file: true
194
+ workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
195
+ service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
196
+
197
+ - name: Halt release
198
+ env:
199
+ # google-github-actions/auth with create_credentials_file: true sets GOOGLE_APPLICATION_CREDENTIALS
200
+ # You can also inject required params via HALT_GOOGLE_PLAY_RELEASE_{PACKAGE_NAME,TRACK,VERSION_NAME}
201
+ HALT_GOOGLE_PLAY_RELEASE_PACKAGE_NAME: com.example.app
202
+ HALT_GOOGLE_PLAY_RELEASE_TRACK: production
203
+ HALT_GOOGLE_PLAY_RELEASE_VERSION_NAME: ${{ inputs.version_name }}
204
+ run: bundle exec fastlane halt_release
205
+ ```
206
+
207
+ ```ruby
208
+ lane :halt_release do
209
+ # Params are injected from HALT_GOOGLE_PLAY_RELEASE_{PACKAGE_NAME,TRACK,VERSION_NAME}
210
+ # GOOGLE_APPLICATION_CREDENTIALS is set by google-github-actions/auth
211
+ halt_google_play_release
212
+
213
+ # You can also specify directly
214
+ # halt_google_play_release(
215
+ # package_name: ENV['YOUR_PACKAGE_NAME_ENVIRONMENT_NAME'],
216
+ # version_name: "1.0.0",
217
+ # json_file_path: "path/to/service-account.json"
218
+ #)
219
+ end
220
+ ```
221
+
150
222
  ## Run tests for this plugin
151
223
 
152
224
  To run both the tests, and code style validation, run
@@ -16,15 +16,23 @@ module Fastlane
16
16
  # @raise [FastlaneCore::Interface::FastlaneError] If neither or both authentication parameters are provided
17
17
  # @raise [FastlaneCore::Interface::FastlaneError] If the JSON type is not 'service_account' or 'external_account'
18
18
  def initialize(json_file_path: nil, json_key_data: nil)
19
- if json_file_path.nil? && json_key_data.nil?
20
- UI.user_error!('Specify exactly one of \'json_file_path: \' or \'json_key_data: \' for service/external account authentication.')
19
+ env_credentials_path = ENV.fetch('GOOGLE_APPLICATION_CREDENTIALS', nil)
20
+
21
+ if json_file_path.nil? && json_key_data.nil? && env_credentials_path.nil?
22
+ UI.user_error!('Specify exactly one of \'json_file_path: \' or \'json_key_data: \' for service/external account authentication, or set GOOGLE_APPLICATION_CREDENTIALS environment variable.')
21
23
  end
22
24
 
23
- account_raw_json = if json_file_path
24
- File.open(File.expand_path(json_file_path))
25
- elsif json_key_data
26
- StringIO.new(json_key_data)
27
- end
25
+ account_raw_json = nil
26
+ if env_credentials_path
27
+ UI.message("Using credentials from GOOGLE_APPLICATION_CREDENTIALS environment variable: #{env_credentials_path}")
28
+ account_raw_json = File.open(File.expand_path(env_credentials_path))
29
+ elsif json_file_path
30
+ UI.message("Using credentials from json_file_path: #{json_file_path}")
31
+ account_raw_json = File.open(File.expand_path(json_file_path))
32
+ elsif json_key_data
33
+ UI.message("Using credentials from json_key_data")
34
+ account_raw_json = StringIO.new(json_key_data)
35
+ end
28
36
  account_json = JSON.parse(account_raw_json.read)
29
37
  account_raw_json.rewind
30
38
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module GooglePlayTrackUpdater
3
- VERSION = "0.1.0"
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-google_play_track_updater
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takuma Homma