-
Notifications
You must be signed in to change notification settings - Fork 3
Add xcframework code signing #966
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jkmassel
wants to merge
1
commit into
trunk
Choose a base branch
from
add/xcframework-code-signing
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,21 @@ PROJECT_NAME = 'wordpress-rs' | |
# GlotPress configuration | ||
GLOTPRESS_PROJECT_BASE_URL = 'https://translate.wordpress.com/projects/mobile/wordpress-rs' | ||
|
||
# Code Signing | ||
APPLE_TEAM_ID = 'PZYM8XX95Q' | ||
APPLE_BUNDLE_IDENTIFIER = 'com.automattic.hostmgr' | ||
|
||
ASC_API_KEY_ENV_VARS = %w[ | ||
APP_STORE_CONNECT_API_KEY_KEY_ID | ||
APP_STORE_CONNECT_API_KEY_ISSUER_ID | ||
APP_STORE_CONNECT_API_KEY_KEY | ||
].freeze | ||
|
||
CODE_SIGNING_STORAGE_ENV_VARS = %w[ | ||
MATCH_S3_ACCESS_KEY | ||
MATCH_S3_SECRET_ACCESS_KEY | ||
].freeze | ||
|
||
# Supported locales mapping between GlotPress and project locale codes | ||
# This list combines locales supported in the iOS and Android apps | ||
SUPPORTED_LOCALES = [ | ||
|
@@ -90,7 +105,7 @@ lane :release do |options| | |
|
||
validate | ||
update_swift_package | ||
publish_github_release | ||
publish_release_to_github | ||
publish_to_s3 | ||
end | ||
|
||
|
@@ -124,7 +139,7 @@ lane :update_swift_package do | |
File.open(file_path, 'w') { |file| file.puts lines } | ||
end | ||
|
||
lane :publish_github_release do | ||
lane :publish_release_to_github do | ||
version = lane_context[LANE_VALUE_VERSION] || UI.user_error!('Missing version lane context') | ||
github_token = lane_context[LANE_VALUE_GITHUB_TOKEN] || UI.user_error!('Missing github token lane context') | ||
|
||
|
@@ -396,6 +411,27 @@ lane :generate_fluent_file_from_po do |file_path:| | |
fluent_file_path | ||
end | ||
|
||
desc 'Download the development signing certificates to this machine' | ||
lane :set_up_signing do |readonly: true| | ||
require_env_vars!(*ASC_API_KEY_ENV_VARS, *CODE_SIGNING_STORAGE_ENV_VARS) | ||
|
||
sync_code_signing( | ||
platform: 'macos', | ||
app_identifier: APPLE_BUNDLE_IDENTIFIER, | ||
team_id: APPLE_TEAM_ID, | ||
api_key: app_store_connect_api_key, | ||
type: 'development', | ||
certificate_id: 'Apple Development: Created via API (886NX39KP6)', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you think about using the "Apple Distribution" one instead? I feel like it's appropriate to use binaries that are signed with "Apple Distribution" on all builds, but "Apple Development" builds may not be suitable for release builds. |
||
|
||
storage_mode: 's3', | ||
s3_region: 'us-east-2', | ||
s3_bucket: 'a8c-fastlane-match', | ||
|
||
readonly: readonly | ||
) | ||
end | ||
|
||
|
||
# Utils | ||
|
||
def xcframework_checksum | ||
|
@@ -463,3 +499,17 @@ def only_date_headers_changed?(file_path) | |
|
||
changed_lines.all? { |l| l.include?('"POT-Creation-Date:') || l.include?('"PO-Revision-Date:') } | ||
end | ||
|
||
# Use this to ensure all env vars a lane requires are set. | ||
# | ||
# The best place to call this is at the start of a lane, to fail early. | ||
def require_env_vars!(*keys) | ||
keys.each { |key| get_required_env!(key) } | ||
end | ||
|
||
# Use this instead of getting values from `ENV` directly. It will throw an error if the requested value is missing. | ||
def get_required_env!(key) | ||
return ENV.fetch(key) if ENV.key?(key) | ||
|
||
UI.user_error!("Environment variable `#{key}` is not set.") | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand it correctly, this bundle id is only for fastlane to download the certificates and things. If that's the case, can we move it into the
set_up_signing
lane, to avoid the potential confusion thatcom.automattic.hostmgr
is the "bundle id" of the wordpress-rs xcframework?