Skip to content

Instantly share code, notes, and snippets.

@jsorge

jsorge/.env Secret

Last active February 26, 2023 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsorge/302f9eed6d617e0670cfa354e8d2afb4 to your computer and use it in GitHub Desktop.
Save jsorge/302f9eed6d617e0670cfa354e8d2afb4 to your computer and use it in GitHub Desktop.
Fastlane custom action demo
MATCH_KEYCHAIN_NAME = MyGreatKeychain
FL_IOS_BUNDLE_IDS = com.example.iosapp, com.example.iosapp.notificationext
ASC_KEY_ISSUER_ID = // the id of the key issuer
ASC_KEY_CONTENT = // the base64 encoded api key
ASC_KEY_ID = // the id of the app store connect api key
MATCH_KEYCHAIN_PASSWORD = // keychain password
fastlane_require "dotenv"
lane :signing do
Dotenv.overload '.env.personal'
app_store_connect_api_key(
key_id: ENV['ASC_KEY_ID'],
issuer_id: ENV['ASC_KEY_ISSUER_ID'],
key_content: ENV['ASC_KEY_CONTENT'],
is_key_content_base64: true
)
rebuild_signing
end
# frozen_string_literal: true
require 'fastlane_core'
module Fastlane
module Actions
class RebuildSigningAction < Action
def self.run(params)
ios_bundle_ids = params[:ios_bundle_ids]
other_action.create_keychain(
name: params[:keychain_name],
password: params[:keychain_password],
unlock: true
)
UI.message "Revoking provisioning profiles for #{ios_bundle_ids}"
other_action.match_nuke(
type: 'appstore',
readonly: false,
app_identifier: ios_bundle_ids
)
UI.message 'Re-creating provisioning profiles and certificates'
other_action.match(
readonly: false,
app_identifier: ios_bundle_ids,
platform: 'ios'
)
end
#####################################################
# @!group Documentation
#####################################################
def self.description
'This action will revoke and regenerate signing certs and provisioning profiles'
end
def self.details
'This action makes it easy to rebuild iOS code signing needs in one step. '\
'Prior to running there needs to be an App Store Connect API key in the environment '\
'which can be done using the `app_store_connect_api_key` action.'
end
def self.available_options
[
FastlaneCore::ConfigItem.new(
key: :keychain_name,
env_name: 'MATCH_KEYCHAIN_NAME',
description: 'The name of the keychain which will hold certificates'
),
FastlaneCore::ConfigItem.new(
key: :keychain_password,
env_name: 'MATCH_KEYCHAIN_PASSWORD',
description: 'The password of the keychain which will hold certificates'
),
FastlaneCore::ConfigItem.new(
key: :ios_bundle_ids,
env_name: 'FL_IOS_BUNDLE_IDS',
description: 'An array of strings which are the iOS bundle IDs to re-provision. These should be passed in space-separated as in a shell string that is parsed in to an array',
type: Array
)
]
end
def self.authors
['jsorge']
end
def self.is_supported?(_platform)
true
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment