Skip to content

Commit 0782c6b

Browse files
authored
Merge pull request #11 from AztecProtocol/ad/feat-ci-metadata-aztec-network
1 parent eef7162 commit 0782c6b

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

.github/workflows/deploy-to-s3.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Deploy network_config.json to S3
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
# Intentionally not checking for actual file changes right now to allow for testing without content changes
8+
9+
jobs:
10+
deploy:
11+
name: Deploy to S3 and Invalidate CloudFront
12+
runs-on: ubuntu-latest
13+
14+
permissions:
15+
contents: read
16+
id-token: write
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Configure AWS credentials
23+
uses: aws-actions/configure-aws-credentials@v4
24+
with:
25+
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
26+
aws-region: eu-west-2
27+
28+
- name: Copy network_config.json to S3
29+
run: |
30+
echo "Copying network_config.json to S3 bucket aztec-network-metadata..."
31+
aws s3 cp network_config.json s3://aztec-network-metadata/network_config.json \
32+
--content-type "application/json"
33+
echo "Successfully uploaded network_config.json to S3"
34+
35+
- name: Invalidate CloudFront cache
36+
run: |
37+
echo "Creating CloudFront invalidation for distribution E2P2Y6OY8B3H98..."
38+
INVALIDATION_ID=$(aws cloudfront create-invalidation \
39+
--distribution-id E2P2Y6OY8B3H98 \
40+
--paths "/network_config.json" \
41+
--query 'Invalidation.Id' \
42+
--output text)
43+
echo "CloudFront invalidation created with ID: $INVALIDATION_ID"
44+
45+
echo "Waiting for invalidation to complete..."
46+
aws cloudfront wait invalidation-completed \
47+
--distribution-id E2P2Y6OY8B3H98 \
48+
--id "$INVALIDATION_ID"
49+
echo "CloudFront cache invalidation completed successfully"
50+
51+
- name: Verify deployment
52+
run: |
53+
echo "Verifying deployment..."
54+
echo "S3 URL: https://aztec-network-metadata.s3.amazonaws.com/network_config.json"
55+
echo "CloudFront URL: https://metadata.aztec.network/network_config.json"
56+
57+
# Download the deployed file from CloudFront
58+
echo "Downloading deployed file from metadata.aztec.network..."
59+
curl -s https://metadata.aztec.network/network_config.json -o deployed_network_config.json
60+
61+
# Compare the files
62+
echo "Comparing local and deployed files..."
63+
if diff -u network_config.json deployed_network_config.json; then
64+
echo "✅ Verification successful: Deployed file matches repository file"
65+
else
66+
echo "❌ Verification failed: Files do not match!"
67+
echo "Differences found between repository and deployed version"
68+
exit 1
69+
fi

0 commit comments

Comments
 (0)