diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 676286c130..96e8c43d28 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -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/ssh-agent@v0.6.0 with: ssh-private-key: | @@ -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 }} diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 6d31f4df42..27065332df 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -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) @@ -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