Skip to content

Commit 710b704

Browse files
committed
🎉 Initial commit
0 parents  commit 710b704

23 files changed

+3229
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.github/workflows/deploy.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
concurrency:
8+
group: deploy-${{ github.ref }}
9+
cancel-in-progress: false
10+
11+
permissions:
12+
id-token: write
13+
contents: read
14+
deployments: write
15+
16+
env:
17+
AWS_REGION: us-east-1
18+
ENVIRONMENT: prod
19+
TF_DIR: terraform
20+
21+
jobs:
22+
deploy:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- uses: actions/setup-python@v5
28+
with:
29+
python-version: "3.11"
30+
31+
- uses: hashicorp/setup-terraform@v3
32+
with:
33+
terraform_version: "~1.0"
34+
35+
- uses: aws-actions/configure-aws-credentials@v4
36+
with:
37+
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
38+
aws-region: ${{ env.AWS_REGION }}
39+
40+
- name: Create deployment
41+
uses: chrnorm/deployment-action@v2
42+
id: deployment
43+
with:
44+
token: ${{ github.token }}
45+
environment: production
46+
description: "Deploy ${{ github.sha }}"
47+
48+
- name: Build Lambda layer
49+
run: |
50+
mkdir -p build/lambda-layer/python
51+
pip install \
52+
--target build/lambda-layer/python \
53+
--platform manylinux2014_x86_64 \
54+
--python-version 3.11 \
55+
--only-binary=:all: \
56+
web3 eth-abi
57+
cd build/lambda-layer
58+
zip -r ../python-deps.zip python/ > /dev/null
59+
60+
- name: Upload Lambda layer to S3
61+
run: |
62+
BUCKET="aztec-supply-lambda-artifacts-${ENVIRONMENT}"
63+
aws s3 cp build/python-deps.zip "s3://${BUCKET}/layers/python-deps.zip"
64+
65+
- name: Terraform init
66+
working-directory: ${{ env.TF_DIR }}
67+
run: |
68+
terraform init \
69+
-backend-config="bucket=${{ secrets.TF_STATE_BUCKET }}" \
70+
-backend-config="key=aztec-supply/terraform.tfstate" \
71+
-backend-config="region=${AWS_REGION}"
72+
73+
- name: Terraform plan
74+
working-directory: ${{ env.TF_DIR }}
75+
run: terraform plan -out=tfplan -input=false
76+
env:
77+
TF_VAR_eth_rpc_url: ${{ secrets.ETH_RPC_URL }}
78+
TF_VAR_route53_zone_id: ${{ secrets.ROUTE53_ZONE_ID }}
79+
TF_VAR_aws_region: ${{ env.AWS_REGION }}
80+
TF_VAR_environment: ${{ env.ENVIRONMENT }}
81+
82+
- name: Terraform apply
83+
working-directory: ${{ env.TF_DIR }}
84+
run: terraform apply -input=false tfplan
85+
86+
- name: Smoke test
87+
run: |
88+
sleep 5
89+
STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://supply.aztec.network/ || true)
90+
if [ "$STATUS" = "200" ]; then
91+
echo "API returned 200 OK"
92+
else
93+
echo "Warning: API returned $STATUS (may need time for DNS propagation)"
94+
fi
95+
96+
- name: Update deployment status (success)
97+
if: success()
98+
uses: chrnorm/deployment-status@v2
99+
with:
100+
token: ${{ github.token }}
101+
state: success
102+
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
103+
environment-url: https://supply.aztec.network
104+
105+
- name: Update deployment status (failure)
106+
if: failure()
107+
uses: chrnorm/deployment-status@v2
108+
with:
109+
token: ${{ github.token }}
110+
state: failure
111+
deployment-id: ${{ steps.deployment.outputs.deployment_id }}

0 commit comments

Comments
 (0)