Skip to content

Conversation

AliSoftware
Copy link
Contributor

@AliSoftware AliSoftware commented Jun 12, 2025

What does it do?

Update upload_build_to_apps_cdn action with newly-added install_type and sha API parameters.

Context: p1749744798120189/1742566597.679029-slack-CC7L49W13
Closes AINFRA-743

Testing

  1. Edit the Gemfile of your client repo (e.g. WPStudio) to make the dependency line for the release toolkit point to the branch directly instead of a version:
    gem 'fastlane-plugin-wpmreleasetoolkit', git: 'https://github.com/wordpress-mobile/release-toolkit.git', branch: 'ainfra-743-update-release-toolkit-for-new-appscdn-parameters'
  2. Then run bundle install in your client repo to resolve the dependencies
  3. Edit the lane in your Fastfile that uses that action to add the install_type and sha parameters to the action call
  4. Call bundle exec fastlane <lanename> command as usual to test running that lane with the new parameters and action version.

Checklist before requesting a review

  • Run bundle exec rubocop to test for code style violations and recommendations.
  • Add Unit Tests (aka specs/*_spec.rb) if applicable.
  • Run bundle exec rspec to run the whole test suite and ensure all your tests pass.
  • Make sure you added an entry in the CHANGELOG.md file to describe your changes under the appropriate existing ### subsection of the existing ## Trunk section.
  • If applicable, add an entry in the MIGRATION.md file to describe how the changes will affect the migration from the previous major version and what the clients will need to change and consider.

@AliSoftware AliSoftware self-assigned this Jun 12, 2025
@AliSoftware AliSoftware requested a review from a team June 12, 2025 19:45
@AliSoftware AliSoftware added the enhancement New feature or request label Jun 12, 2025
For more compact code and better readability in individual tests
Moves the new ones closer to related parameters, and ensure we keep the ones that are about build metadata together and leave `error_on_duplicate` and `api_token` at the end.
@sejas
Copy link

sejas commented Jun 13, 2025

Thanks for creating the PR! The code looks good to me.
I'm not sure how to test it without releasing a new version of the release toolkit.

@AliSoftware
Copy link
Contributor Author

AliSoftware commented Jun 13, 2025

Sorry I should have added Testing Instructions to the PR description!

You can test it on your client repo (Studio) by:

  • Editing the Gemfile in your repo to make the dependency line for the release toolkit point to the branch directly instead of a version:
    gem 'fastlane-plugin-wpmreleasetoolkit', git: 'https://github.com/wordpress-mobile/release-toolkit.git', branch: 'ainfra-743-update-release-toolkit-for-new-appscdn-parameters'
  • Run bundle install to resolve the dependencies
  • Then call your bundle exec fastlane <lanename> command as usual from there to test your Fastfile lane with the updated action

Copy link

sejas commented Jun 13, 2025

Awesome! Thanks for sharing the testing instructions. This entire Gemfile world is new to me.
I'll give it a try on Monday. Thank you!

end
),
FastlaneCore::ConfigItem.new(
key: :install_type,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@iangmaia iangmaia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM 👍

@AliSoftware AliSoftware merged commit a75f963 into trunk Jun 17, 2025
6 checks passed
@AliSoftware AliSoftware deleted the ainfra-743-update-release-toolkit-for-new-appscdn-parameters branch June 17, 2025 11:42
Copy link

@sejas sejas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirm these changes add the two new parameters install_type and sha required by Studio CI. I tested it on my Studio PR, Automattic/studio#1422, by following these testing steps:

  1. Update Gemfile
diff --git a/Gemfile b/Gemfile
index 48ed42ea..58dff5f6 100644
--- a/Gemfile
+++ b/Gemfile
@@ -3,8 +3,7 @@
 source 'https://rubygems.org'
 
 gem 'fastlane', '~> 2.212'
-gem 'fastlane-plugin-wpmreleasetoolkit', '~> 13.2'
-
+gem 'fastlane-plugin-wpmreleasetoolkit', git: 'https://github.com/wordpress-mobile/release-toolkit.git', branch: 'ainfra-743-update-release-toolkit-for-new-appscdn-parameters'
 gem 'aws-sdk-cloudfront', '~> 1.87'
 
 gem 'rubocop', '~> 1.42', require: false
  1. Run bundle install
  2. Run bundle exec fastlane action upload_build_to_apps_cdn
  3. Observe the new options in the details:
Click to reveal the options details

[✔] 🚀 
+---------------------------------------------------------------------------------+
|                                  Used plugins                                   |
+-----------------------------------+---------+-----------------------------------+
| Plugin                            | Version | Action                            |
+-----------------------------------+---------+-----------------------------------+
| fastlane-plugin-wpmreleasetoolki  | 13.2.0  | an_localize_libs,                 |
| t                                 |         | an_update_metadata_source,        |
|                                   |         | an_validate_lib_strings,          |
|                                   |         | android_build_preflight,          |
|                                   |         | android_create_avd,               |
|                                   |         | android_create_xml_release_notes  |
|                                   |         | ,                                 |
|                                   |         | android_current_branch_is_hotfix  |
|                                   |         | ,                                 |
|                                   |         | android_download_file_by_version  |
|                                   |         | , android_download_translations,  |
|                                   |         | android_firebase_test,            |
|                                   |         | android_launch_emulator,          |
|                                   |         | android_send_app_size_metrics,    |
|                                   |         | android_shutdown_emulator,        |
|                                   |         | android_update_release_notes,     |
|                                   |         | buildkite_add_trigger_step,       |
|                                   |         | buildkite_annotate,               |
|                                   |         | buildkite_metadata,               |
|                                   |         | buildkite_pipeline_upload,        |
|                                   |         | buildkite_trigger_build,          |
|                                   |         | check_for_toolkit_updates,        |
|                                   |         | check_translation_progress,       |
|                                   |         | circleci_trigger_job,             |
|                                   |         | close_milestone, comment_on_pr,   |
|                                   |         | copy_branch_protection,           |
|                                   |         | create_github_release,            |
|                                   |         | create_new_milestone,             |
|                                   |         | create_release_backmerge_pull_re  |
|                                   |         | quest,                            |
|                                   |         | extract_release_notes_for_versio  |
|                                   |         | n, find_previous_tag,             |
|                                   |         | firebase_login,                   |
|                                   |         | get_prs_between_tags,             |
|                                   |         | gp_downloadmetadata,              |
|                                   |         | gp_update_metadata_source,        |
|                                   |         | openai_ask, promo_screenshots,    |
|                                   |         | prototype_build_details_comment,  |
|                                   |         | publish_github_release,           |
|                                   |         | remove_branch_protection,         |
|                                   |         | set_branch_protection,            |
|                                   |         | set_milestone_frozen_marker,      |
|                                   |         | update_assigned_milestone,        |
|                                   |         | upload_build_to_apps_cdn,         |
|                                   |         | upload_to_s3,                     |
|                                   |         | configure_add_files_to_copy,      |
|                                   |         | configure_apply,                  |
|                                   |         | configure_download,               |
|                                   |         | configure_setup,                  |
|                                   |         | configure_update,                 |
|                                   |         | configure_validate,               |
|                                   |         | add_development_certificates_to_  |
|                                   |         | provisioning_profiles,            |
|                                   |         | add_devices_to_provisioning_prof  |
|                                   |         | iles, ios_build_preflight,        |
|                                   |         | ios_check_beta_deps,              |
|                                   |         | ios_download_strings_files_from_  |
|                                   |         | glotpress,                        |
|                                   |         | ios_extract_keys_from_strings_fi  |
|                                   |         | les,                              |
|                                   |         | ios_generate_strings_file_from_c  |
|                                   |         | ode, ios_get_store_app_sizes,     |
|                                   |         | ios_lint_localizations,           |
|                                   |         | ios_merge_strings_files,          |
|                                   |         | ios_send_app_size_metrics,        |
|                                   |         | ios_update_metadata_source,       |
|                                   |         | ios_update_release_notes          |
+-----------------------------------+---------+-----------------------------------+

Loading documentation for upload_build_to_apps_cdn:

+---------------------------------------------------------------------------------------+
| upload_build_to_apps_cdn |
+---------------------------------------------------------------------------------------+
| Uploads a build binary to the Apps CDN |
| |
| Uploads a build binary file to a WordPress blog that has the Apps CDN plugin enabled. |
| See PCYsg-15tP-p2 internal a8c documentation for details about the Apps CDN plugin. |
| |
| Created by Automattic |
+---------------------------------------------------------------------------------------+

+--------------------------------------------------------------------------------------+
| upload_build_to_apps_cdn Options |
+------------------------+--------------------------+-------------------+--------------+
| Key | Description | Env Var(s) | Default |
+------------------------+--------------------------+-------------------+--------------+
| site_id | The WordPress.com CDN | APPS_CDN_SITE_ID | |
| | site ID to upload the | | |
| | media to | | |
| product | The product the build | APPS_CDN_PRODUCT | |
| | belongs to (e.g. | | |
| | 'WordPress.com Studio') | | |
| platform | The platform the build | APPS_CDN_PLATFORM | |
| | runs on. One of: | | |
| | Android, iOS, Mac - | | |
| | Silicon, Mac - Intel, | | |
| | Mac - Any, Windows | | |
| file_path | The path to the build | | |
| | file to upload | | |
| build_type | The type of the build. | | |
| | One of: Alpha, Beta, | | |
| | Nightly, Production, | | |
| | Prototype | | |
| install_type | The install type for | | Full Install |
| | the build. One of: Full | | |
| | Install, Update | | |
| visibility | The visibility of the | | |
| | build (:internal or | | |
| | :external) | | |
| post_status | The post status | | publish |
| | (defaults to 'publish') | | |
| version | The version string for | | |
| | the build (e.g. '20.0', | | |
| | '17.8.1') | | |
| build_number | The build number for | | |
| | the build (e.g. '42') | | |
| minimum_system_version | The minimum version for | | |
| | the provided platform | | |
| | (e.g. '13.0' for macOS | | |
| | Ventura) | | |
| release_notes | The release notes to | | |
| | show with the build on | | |
| | the blog frontend | | |
| sha | A string representing | | |
| | the release, e.g. the | | |
| | most recent commit | | |
| | hash, cryptographic | | |
| | token, etc | | |
| error_on_duplicate | If true, the action | | false |
| | will error if a build | | |
| | matching the same | | |
| | metadata already | | |
| | exists. If false, any | | |
| | potential existing | | |
| | build matching the same | | |
| | metadata will be | | |
| | updated to replace the | | |
| | build with the new file | | |
| api_token | The WordPress.com API | WPCOM_API_TOKEN | |
| | token for | | |
| | authentication | | |
+------------------------+--------------------------+-------------------+--------------+

  • = default value is dependent on the user's system

+-----------------------------------------------------------------------------------+
| upload_build_to_apps_cdn Output Variables |
+----------------------------+------------------------------------------------------+
| Key | Description |
+----------------------------+------------------------------------------------------+
| APPS_CDN_UPLOADED_FILE_URL | The URL of the uploaded file |
| APPS_CDN_UPLOADED_FILE_ID | The ID of the uploaded file |
| APPS_CDN_UPLOADED_POST_ID | The ID of the post / page created for the uploaded |
| | build |
| APPS_CDN_UPLOADED_POST_URL | The URL of the post / page created for the uploaded |
| | build |
+----------------------------+------------------------------------------------------+
Access the output values using lane_context[SharedValues::VARIABLE_NAME]

+--------------------------------------------------------------------------------------------------------------+
| upload_build_to_apps_cdn Return Value |
+--------------------------------------------------------------------------------------------------------------+
| Returns a Hash containing the upload result: { post_id:, post_url:, media_id:, media_url:, mime_type: }. On |
| error, raises a FastlaneError. |
+--------------------------------------------------------------------------------------------------------------+

More information can be found on https://docs.fastlane.tools/actions/upload_build_to_apps_cdn


[!IMPORTANT]
If your app relies on managed capabilities (previously referred to as custom entitlements or the template_name parameter in match), you are impacted by a change that Apple made to their APIs in the last 2 weeks.
Please check out the ongoing discussion at fastlane/fastlane#29609 for the latest updates. Your insights and contributions are welcome!

Please update using bundle update fastlane

Thanks for the changes! 🙌

@AliSoftware
Copy link
Contributor Author

Thanks for confirming @sejas !

I have now released an official version 13.3.0 of the release-toolkit, so you should be able to update your Studio PR to have the Gemfile back to point to it, then running bundle install again to point to that official release now 👍

gem 'fastlane-plugin-wpmreleasetoolkit', '~> 13.3'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants