Skip to content

Commit 40714c7

Browse files
authored
Dry run action + workflow cleanup (#2)
* Dry run action + workflow cleanup * update env variables for AWS region * migrated tf state * Update Terraform backend bucket in deploy workflow * remove foundation profile * Rename Terraform plan step for clarity
1 parent 5905dce commit 40714c7

3 files changed

Lines changed: 77 additions & 32 deletions

File tree

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Deploy (dry run)
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches: [main]
7+
8+
concurrency:
9+
group: deploy-dry-run-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
id-token: write
14+
contents: read
15+
16+
env:
17+
AWS_REGION: ${{ vars.AWS_REGION }}
18+
ENVIRONMENT: prod
19+
TF_DIR: terraform
20+
21+
jobs:
22+
deploy-dry-run:
23+
runs-on: ubuntu-latest
24+
environment: prod
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- uses: actions/setup-python@v5
29+
with:
30+
python-version: "3.11"
31+
32+
- uses: hashicorp/setup-terraform@v3
33+
with:
34+
terraform_version: "~1.0"
35+
36+
- uses: aws-actions/configure-aws-credentials@v4
37+
with:
38+
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
39+
aws-region: ${{ env.AWS_REGION }}
40+
41+
- name: Install Poetry
42+
run: pip install poetry poetry-plugin-export
43+
44+
- name: Build Lambda layer (local only)
45+
run: |
46+
mkdir -p build/lambda-layer/python
47+
poetry export -f requirements.txt --without-hashes -o build/requirements.txt
48+
pip install \
49+
--target build/lambda-layer/python \
50+
--platform manylinux2014_x86_64 \
51+
--python-version 3.11 \
52+
--only-binary=:all: \
53+
-r build/requirements.txt
54+
cd build/lambda-layer
55+
zip -r ../python-deps.zip python/ > /dev/null
56+
57+
- name: Terraform init
58+
working-directory: ${{ env.TF_DIR }}
59+
run: |
60+
terraform init \
61+
-backend-config="bucket=aztec-circ-supply-terraform" \
62+
-backend-config="key=circulating-supply-api" \
63+
-backend-config="region=${AWS_REGION}"
64+
65+
- name: Terraform plan
66+
working-directory: ${{ env.TF_DIR }}
67+
run: terraform plan -out=tfplan -input=false
68+
env:
69+
TF_VAR_eth_rpc_url: ${{ secrets.ETH_RPC_URL }}
70+
TF_VAR_route53_zone_id: ${{ secrets.ROUTE53_ZONE_ID }}
71+
TF_VAR_aws_region: ${{ env.AWS_REGION }}
72+
TF_VAR_environment: ${{ env.ENVIRONMENT }}
73+

‎.github/workflows/deploy.yml‎

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ concurrency:
1111
permissions:
1212
id-token: write
1313
contents: read
14-
deployments: write
15-
1614
env:
17-
AWS_REGION: eu-west-2
15+
AWS_REGION: ${{ vars.AWS_REGION }}
1816
ENVIRONMENT: prod
1917
TF_DIR: terraform
2018

@@ -38,14 +36,6 @@ jobs:
3836
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
3937
aws-region: ${{ env.AWS_REGION }}
4038

41-
- name: Create deployment
42-
uses: chrnorm/deployment-action@v2
43-
id: deployment
44-
with:
45-
token: ${{ github.token }}
46-
environment: production
47-
description: "Deploy ${{ github.sha }}"
48-
4939
- name: Install Poetry
5040
run: pip install poetry poetry-plugin-export
5141

@@ -98,19 +88,3 @@ jobs:
9888
echo "Warning: API returned $STATUS (may need time for DNS propagation)"
9989
fi
10090
101-
- name: Update deployment status (success)
102-
if: success()
103-
uses: chrnorm/deployment-status@v2
104-
with:
105-
token: ${{ github.token }}
106-
state: success
107-
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
108-
environment-url: https://supply.aztec.network
109-
110-
- name: Update deployment status (failure)
111-
if: failure()
112-
uses: chrnorm/deployment-status@v2
113-
with:
114-
token: ${{ github.token }}
115-
state: failure
116-
deployment-id: ${{ steps.deployment.outputs.deployment_id }}

‎terraform/main.tf‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ terraform {
1313
}
1414

1515
backend "s3" {
16-
bucket = "aztec-foundation-terraform-state"
16+
bucket = "aztec-circ-supply-terraform"
1717
key = "circulating-supply-api"
1818
region = "eu-west-2"
1919
}
2020
}
2121

2222
provider "aws" {
23-
profile = "foundation"
2423
region = var.aws_region
2524

2625
default_tags {
@@ -34,9 +33,8 @@ provider "aws" {
3433

3534
# ACM certificates for CloudFront must be in us-east-1
3635
provider "aws" {
37-
alias = "us_east_1"
38-
profile = "foundation"
39-
region = "us-east-1"
36+
alias = "us_east_1"
37+
region = "us-east-1"
4038

4139
default_tags {
4240
tags = {

0 commit comments

Comments
 (0)