Skip to content

Instantly share code, notes, and snippets.

@fra3il

fra3il/0.sh Secret

Last active January 19, 2016 06:32
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 fra3il/4f9435b90fa61dc012e3 to your computer and use it in GitHub Desktop.
Save fra3il/4f9435b90fa61dc012e3 to your computer and use it in GitHub Desktop.
[WP/1448] fastlane 에 action 을 추가하는 방법
$ fastlane new_action
Must be lower case, and use a '_' between words. Do not use '.'
examples: 'testflight', 'upload_to_s3'
Name of your action: cert_expiration_check
[18:27:39]: Created new action file './fastlane/actions/cert_expiration_check.rb'. Edit it to implement your custom action.
module Fastlane
module Actions
module SharedValues
CERT_EXPIRATION_CHECK_CUSTOM_VALUE = :CERT_EXPIRATION_CHECK_CUSTOM_VALUE
end
# To share this integration with the other fastlane users:
# - Fork https://github.com/fastlane/fastlane
# - Clone the forked repository
# - Move this integration into lib/fastlane/actions
# - Commit, push and submit the pull request
class CertExpirationCheckAction < Action
def self.run(params)
# fastlane will take care of reading in the parameter and fetching the environment variable:
Helper.log.info "Parameter API Token: #{params[:api_token]}"
# sh "shellcommand ./path"
# Actions.lane_context[SharedValues::CERT_EXPIRATION_CHECK_CUSTOM_VALUE] = "my_val"
end
#####################################################
# @!group Documentation
#####################################################
def self.description
"A short description with <= 80 characters of what this action does"
end
def self.details
# Optional:
# this is your change to provide a more detailed description of this action
"You can use this action to do cool things..."
end
def self.available_options
# Define all options your action supports.
# Below a few examples
[
FastlaneCore::ConfigItem.new(key: :api_token,
env_name: "FL_CERT_EXPIRATION_CHECK_API_TOKEN", # The name of the environment variable
description: "API Token for CertExpirationCheckAction", # a short description of this parameter
verify_block: proc do |value|
raise "No API token for CertExpirationCheckAction given, pass using `api_token: 'token'`".red unless (value and not value.empty?)
# raise "Couldn't find file at path '#{value}'".red unless File.exist?(value)
end),
FastlaneCore::ConfigItem.new(key: :development,
env_name: "FL_CERT_EXPIRATION_CHECK_DEVELOPMENT",
description: "Create a development certificate instead of a distribution one",
is_string: false, # true: verifies the input is a string, false: every kind of value
default_value: false) # the default value if the user didn't provide one
]
end
def self.output
# Define the shared values you are going to provide
# Example
[
['CERT_EXPIRATION_CHECK_CUSTOM_VALUE', 'A description of what this value contains']
]
end
def self.return_value
# If you method provides a return value, you can describe here what it does
end
def self.authors
# So no one will ever forget your contribution to fastlane :) You are awesome btw!
["Your GitHub/Twitter Name"]
end
def self.is_supported?(platform)
# you can do things like
#
# true
#
# platform == :ios
#
# [:ios, :mac].include?(platform)
#
platform == :ios
end
end
end
end
$ fastlane run cert_expiration_check
[18:31:49]: Successfully loaded custom action '/Users/fra3il/Documents/_MAKEUS/dingo-ios-client/Dingo/fastlane/actions/cert_expiration_check.rb'.
[18:31:49]: -----------------------------------
[18:31:49]: --- Step: cert_expiration_check ---
[18:31:49]: -----------------------------------
[18:31:49]: To not be asked about this value, you can specify it using 'api_token'
API Token for CertExpirationCheckAction:
$ fastlane action cert_expiration_check
[15:03:09]: Successfully loaded custom action '/Users/fra3il/Documents/_MAKEUS/dingo-ios-client/Dingo/fastlane/actions/cert_expiration_check.rb'.
Loading documentation for cert_expiration_check:
+--------------------------------------------------------------------+
| cert_expiration_check |
+--------------------------------------------------------------------+
| A short description with <= 80 characters of what this action does |
| |
| You can use this action to do cool things... |
| |
| Created by Your GitHub/Twitter Name |
+--------------------------------------------------------------------+
+---------------+----------------------------------------------------------------+--------------------------------------+
| cert_expiration_check |
+---------------+----------------------------------------------------------------+--------------------------------------+
| Key | Description | Env Var |
+---------------+----------------------------------------------------------------+--------------------------------------+
| * api_token | API Token for CertExpirationCheckAction | FL_CERT_EXPIRATION_CHECK_API_TOKEN |
| * development | Create a development certificate instead of a distribution one | FL_CERT_EXPIRATION_CHECK_DEVELOPMENT |
+---------------+----------------------------------------------------------------+--------------------------------------+
2 of the available parameters are required
They are marked with an asterisk *
+------------------------------------+-------------------------------------------+
| cert_expiration_check | Output Variables |
+------------------------------------+-------------------------------------------+
| Key | Description |
+------------------------------------+-------------------------------------------+
| CERT_EXPIRATION_CHECK_CUSTOM_VALUE | A description of what this value contains |
+------------------------------------+-------------------------------------------+
Access the output values using `lane_context[SharedValues::VARIABLE_NAME]`
More information can be found on https://github.com/fastlane/fastlane/blob/master/docs/Actions.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment