|
65 | 65 | uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32 # v4.1.0 |
66 | 66 | with: |
67 | 67 | subject-checksums: dist-release/checksums.txt |
| 68 | + |
| 69 | + # A failed release (e.g. an expired Apple notarization agreement) otherwise stays silent |
| 70 | + # until someone hits the stale installer. Post to #bot-patchwave via the shared prod SNS |
| 71 | + # topic + Chatbot instead. Runs on any failure in the pipeline, including the test gate. |
| 72 | + notify-failure: |
| 73 | + name: Notify Slack on failure |
| 74 | + needs: [test, release] |
| 75 | + if: ${{ failure() }} |
| 76 | + runs-on: ubuntu-latest |
| 77 | + timeout-minutes: 5 |
| 78 | + permissions: |
| 79 | + id-token: write # OIDC: assume the release role to publish the Slack alert |
| 80 | + steps: |
| 81 | + - name: Configure AWS credentials |
| 82 | + uses: aws-actions/configure-aws-credentials@d979d5b3a71173a29b74b5b88418bfda9437d885 # v6.1.1 |
| 83 | + with: |
| 84 | + role-to-assume: ${{ secrets.RELEASE_ROLE_ARN }} |
| 85 | + aws-region: us-west-2 |
| 86 | + |
| 87 | + - name: Post failure to #bot-patchwave |
| 88 | + shell: bash |
| 89 | + env: |
| 90 | + TAG: ${{ github.ref_name }} |
| 91 | + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }} |
| 92 | + run: | |
| 93 | + set -euo pipefail |
| 94 | +
|
| 95 | + # The topic name is stable (SlackNotificationTarget: cb-notifications-<channel>); derive |
| 96 | + # the account from the assumed role so no account id is hard-coded in the workflow. |
| 97 | + account="$(aws sts get-caller-identity --query Account --output text)" |
| 98 | + topic_arn="arn:aws:sns:us-west-2:${account}:cb-notifications-bot-patchwave" |
| 99 | +
|
| 100 | + message="$(jq -nc \ |
| 101 | + --arg tag "$TAG" \ |
| 102 | + --arg url "$RUN_URL" \ |
| 103 | + '{ |
| 104 | + version: "1.0", |
| 105 | + source: "custom", |
| 106 | + content: { |
| 107 | + textType: "client-markdown", |
| 108 | + title: (":rotating_light: patchwave-analysis release \($tag) failed"), |
| 109 | + description: ("The release workflow failed. <\($url)|View the failed run>, fix the cause, then re-run it.") |
| 110 | + } |
| 111 | + }')" |
| 112 | +
|
| 113 | + aws sns publish --region us-west-2 --topic-arn "$topic_arn" --message "$message" |
0 commit comments