Skip to content

🧱 Deploy to eu-west-2 #2

🧱 Deploy to eu-west-2

🧱 Deploy to eu-west-2 #2

Workflow file for this run

name: Deploy
on:
push:
branches: [main]
concurrency:
group: deploy-${{ github.ref }}
cancel-in-progress: false
permissions:
id-token: write
contents: read
deployments: write
env:
AWS_REGION: eu-west-2
ENVIRONMENT: prod
TF_DIR: terraform
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: "~1.0"
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: ${{ env.AWS_REGION }}
- name: Create deployment
uses: chrnorm/deployment-action@v2
id: deployment
with:
token: ${{ github.token }}
environment: production
description: "Deploy ${{ github.sha }}"
- name: Build Lambda layer
run: |
mkdir -p build/lambda-layer/python
pip install \
--target build/lambda-layer/python \
--platform manylinux2014_x86_64 \
--python-version 3.11 \
--only-binary=:all: \
web3 eth-abi
cd build/lambda-layer
zip -r ../python-deps.zip python/ > /dev/null
- name: Upload Lambda layer to S3
run: |
BUCKET="aztec-supply-lambda-artifacts-${ENVIRONMENT}"
aws s3 cp build/python-deps.zip "s3://${BUCKET}/layers/python-deps.zip"
- name: Terraform init
working-directory: ${{ env.TF_DIR }}
run: |
terraform init \
-backend-config="bucket=${{ secrets.TF_STATE_BUCKET }}" \
-backend-config="key=aztec-supply/terraform.tfstate" \
-backend-config="region=${AWS_REGION}"
- name: Terraform plan
working-directory: ${{ env.TF_DIR }}
run: terraform plan -out=tfplan -input=false
env:
TF_VAR_eth_rpc_url: ${{ secrets.ETH_RPC_URL }}
TF_VAR_route53_zone_id: ${{ secrets.ROUTE53_ZONE_ID }}
TF_VAR_aws_region: ${{ env.AWS_REGION }}
TF_VAR_environment: ${{ env.ENVIRONMENT }}
- name: Terraform apply
working-directory: ${{ env.TF_DIR }}
run: terraform apply -input=false tfplan
- name: Smoke test
run: |
sleep 5
STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://supply.aztec.network/ || true)
if [ "$STATUS" = "200" ]; then
echo "API returned 200 OK"
else
echo "Warning: API returned $STATUS (may need time for DNS propagation)"
fi
- name: Update deployment status (success)
if: success()
uses: chrnorm/deployment-status@v2
with:
token: ${{ github.token }}
state: success
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
environment-url: https://supply.aztec.network
- name: Update deployment status (failure)
if: failure()
uses: chrnorm/deployment-status@v2
with:
token: ${{ github.token }}
state: failure
deployment-id: ${{ steps.deployment.outputs.deployment_id }}