Repository navigation
43 lines (39 loc) · 1.58 KB
/
Copy pathrollback.yml
File metadata and controls
43 lines (39 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Emergency rollback (README → Rollback): move each function's live alias
# back to its previous published version, in seconds, without Terraform.
# Afterwards, land a revert of the bad merge on main so Terraform's view
# and reality match again.
name: Rollback
on:
workflow_dispatch:
inputs:
functions:
description: Functions to roll back
default: "api mcp stripe-webhook webhook-worker jobs"
permissions:
contents: read
id-token: write
concurrency:
group: production
cancel-in-progress: false
jobs:
rollback:
runs-on: ubuntu-latest
environment: production
steps:
- uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: ${{ vars.AWS_DEPLOY_ROLE_ARN }}
aws-region: ${{ vars.AWS_REGION }}
- name: Point live at the previous version
run: |
for f in ${{ inputs.functions }}; do
name="substratal-prod-$f"
current=$(aws lambda get-alias --function-name "$name" --name live --query FunctionVersion --output text)
previous=$(aws lambda list-versions-by-function --function-name "$name" \
--query "Versions[?Version!='\$LATEST' && to_number(Version) < \`$current\`].Version | [-1]" --output text)
if [ -z "$previous" ] || [ "$previous" = "None" ]; then
echo "::warning::$name has no version before $current"; continue
fi
aws lambda update-alias --function-name "$name" --name live --function-version "$previous" >/dev/null
echo "$name: live $current → $previous"
done