Skip to content

Commit

Permalink
Fastlane send slack message on error (#847)
Browse files Browse the repository at this point in the history
Co-authored-by: Duje Begonja <[email protected]>
  • Loading branch information
CyonAlexRDX and duje-begonja-rdx authored Oct 19, 2023
1 parent 4e804fb commit a3c20a4
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ jobs:
secret-ids: |
FASTLANE_MATCH_REPO_SSH_KEY, ${{ secrets.AWS_SECRET_NAME_WALLET_FASTLANE_SSH }}
parse-json-secrets: true
- name: Fetch webhook AWS secrets
uses: aws-actions/aws-secretsmanager-get-secrets@287592d14d9c9c48199db83dc182ae12af3df18e # v1.0.1
with:
secret-ids: |
WEBHOOK, ${{ secrets.AWS_SECRET_NAME_SLACK_WEBHOOK }}
parse-json-secrets: true
- uses: webfactory/[email protected]
with:
ssh-private-key: |
Expand Down Expand Up @@ -99,3 +105,4 @@ jobs:
bundle exec fastlane deploy --env ios.$FLAVOUR
env:
GIT_TOKEN: ${{ env.WALLET_RADIX_BOT_PAT }}
SLACK_WEBHOOK_URL: ${{ env.WEBHOOK_SLACK_URL }}
32 changes: 31 additions & 1 deletion fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,37 @@ platform :ios do
generate_new_dev_certificates
end

error do |lane, exception, options|
case lane
when :deploy then
commithash = sh("git rev-parse HEAD").strip # Fastlane Action.last_git_commit did not work
gh_workflow_check_url = "https://github.com/radixdlt/babylon-wallet-ios/commit/#{commithash}/checks"

pretext =
<<~EOS
🚨
Failed to Archive app on branch `#{Actions.git_branch}`
See: #{gh_workflow_check_url}
🚨
EOS

message =
<<~EOS
Perhaps you worked with `#if DEBUG`?
Try `bundle exec fastlane build` locally."
EOS

slack(
message: message,
channel: "#chapter--engineering-ios",
slack_url: ENV["SLACK_WEBHOOK_URL"],
success: false, # We just failed...
pretext: pretext,
default_payloads: [],
link_names: true
)
end
end
end

def rev_changelog(flavour, most_recent_tags)
Expand Down Expand Up @@ -163,7 +194,6 @@ private_lane :locate_dsym do |options|
dsymPathUsed
end


private_lane :create_gh_release do |options|
flavour = options.fetch(:flavour).delete_prefix('"').delete_suffix('"') # if accidentally included

Expand Down

0 comments on commit a3c20a4

Please sign in to comment.