-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (82 loc) · 3.25 KB
/
deploy.yml
File metadata and controls
95 lines (82 loc) · 3.25 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Deploy
on:
push:
branches: [main]
paths:
# Only rebuild + redeploy the Phase 2 Lambda when code that actually
# lands in the Docker image changes. DataPhase1 runs as EC2 SSM
# (not Lambda) so changes to phase1-only code would still require a
# separate deploy mechanism — see weekly_collector.py path guard.
- 'collectors/**'
- 'store/**'
- 'weekly_collector.py'
- 'polygon_client.py'
- 'ssm_secrets.py'
- 'lambda/**'
- 'config.py'
- 'flow-doctor.yaml'
- 'requirements*.txt'
- 'Dockerfile*'
- 'infrastructure/deploy.sh'
- '.github/workflows/deploy.yml'
workflow_dispatch:
concurrency:
group: deploy-main
cancel-in-progress: false
permissions:
id-token: write
contents: read
jobs:
deploy:
name: Build + deploy Phase 2 Lambda
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout data repo
uses: actions/checkout@v4
with:
path: alpha-engine-data
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Configure AWS credentials via OIDC
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::711398986525:role/github-actions-lambda-deploy
aws-region: us-east-1
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2
# The deploy.sh canary-rollback path publishes a dedup-keyed alert via
# `python3 -m alpha_engine_lib.alerts publish` (deploy.sh:153) so a
# rolled-back deploy isn't silent on the alert channel beyond the GHA
# red-icon. Without alpha-engine-lib installed in the runner Python,
# the alerts call fails with ModuleNotFoundError and the alert never
# publishes — the recurring failure mode L221 retrofit was designed
# to fix. Pinned to the same v0.26.0 ref as requirements.txt:18 so the
# CI alert path and the Lambda runtime path share a single source of
# truth on the lib version. No extras needed (alerts uses boto3/SNS,
# which is preinstalled on ubuntu-latest).
- name: Set up Python for canary-rollback alert publish
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install alpha-engine-lib for deploy.sh alerts call
run: pip install "alpha-engine-lib @ git+https://github.com/cipher813/alpha-engine-lib@v0.26.0"
- name: Deploy Phase 2 Lambda (alpha-engine-data-collector)
working-directory: alpha-engine-data
run: bash infrastructure/deploy.sh
- name: Report deployed version
working-directory: alpha-engine-data
run: |
echo "Deployed commit: ${{ github.sha }}"
aws lambda get-function \
--function-name alpha-engine-data-collector \
--query "Configuration.[LastModified,CodeSha256]" \
--output text
- name: Append to system-wide deploy changelog
if: always()
uses: cipher813/alpha-engine-docs/.github/actions/append-changelog@main
with:
deploy_status: ${{ job.status == 'success' && 'success' || 'failure' }}
deploy_workflow: deploy.yml