Sorry for such a newbie question, but I'm very confused on how to write a Fastlane script outside of using the supplied methods.
What I'm looking to do is create a variable called message
, that can be passed to the after_all
function, so when I post to Slack, each lane can have it's own custom message:
put message # is this how to set a variable?
lane :alpha do
# This is what I'd like to do
message = "[Google Play] Alpha Channel Deployed"
end
after_all |lane, options| do
slack(message: message)
end
Can anyone point me in the right direction? I'm so utterly lost on how to create and pass variables that don't come from the command line in a Fastfile script
The Fastfile stores the automation configuration that can be run with fastlane. The Fastfile has to be inside your ./fastlane directory. The Fastfile is used to configure fastlane. Open it in your favourite text editor, using Ruby syntax highlighting.
Global Variable has global scope and accessible from anywhere in the program. Assigning to global variables from any point in the program has global implications. Global variable are always prefixed with a dollar sign ($).
noun. Also called express lane. the lane of a multilane roadway that is used by fast-moving vehicles, as when passing slower traffic.
You set a variable using the =
operator, just as you have on line 4. A local variable exists only within the scope where it's created. Assuming the block passed to lane
is called before block passed to after_all
, then changing the first line to message = nil
(so that the variable exists outside the first block's scope) ought to work:
message = nil
lane :alpha do
message = "[Google Play] Alpha Channel Deployed"
end
after_all |lane, options| do
slack(message: message)
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With