Skip to content

Instantly share code, notes, and snippets.

@Sanaebadi97
Created February 28, 2021 12:35
Show Gist options
  • Save Sanaebadi97/04632452ba99eb3594d507dea05b86fa to your computer and use it in GitHub Desktop.
Save Sanaebadi97/04632452ba99eb3594d507dea05b86fa to your computer and use it in GitHub Desktop.
defualt_platforom(:android)
platform : android do
before_all do
ENV["SLACK_URL] ="web hook url"
end
lane :slack_build do
gradle(task: "assembleRelease")
slack(message: "Build Successful!")
upload_to_slack()
end
# Add this to your Fastfile
desc "Upload the APK to Slack channel"
private_lane :upload_to_slack do |options|
file_path = lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH]
file_name = file_path.gsub(/\/.*\//,"")
access_token = "xoxb-962620921426-966094105233-AMDOy1xTlIufyHyL1z8jmVeF"
channel_name = "android"
sh "echo Uploading " + file_name + " to Slack"
sh "curl https://slack.com/api/files.upload -F token=\"" + access_token + "\" -F channels=\"" + channel_name + "\" -F title=\"" + file_name + "\" -F filename=\"" + file_name + "\" -F file=@" + file_path
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment