Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp CD for dev environments #263

Merged
merged 4 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .env.qa
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
NEXT_PUBLIC_ENV=testnet
NEXT_PUBLIC_RIF_WALLET_SERVICES=https://dev.rws.app.rootstockcollective.xyz
NEXT_PUBLIC_EXPLORER=https://explorer.testnet.rootstock.io
NEXT_PUBLIC_BUILD_ID=

NEXT_PUBLIC_RIF_ADDRESS=0x19f64674d8a5b4e652319f5e239efd3bc969a1fe
NEXT_PUBLIC_STRIF_ADDRESS=0x7C19923bac1b41e9bBD1c33815A61854beeD9b54
NEXT_PUBLIC_GOVERNOR_ADDRESS=0x0DB02C99619bB0E6d2cBeF5545Cc968DAb724E10
NEXT_PUBLIC_EA_NFT_ADDRESS=0xa060A65967cb9b9511E3A4ec091Aa81c6dCe6662
NEXT_PUBLIC_MULTICALL_ADDRESS=0xcA11bde05977b3631167028862bE2a173976CA11
NEXT_PUBLIC_GRANTS_BUCKET_ADDRESS=0xfaca664c661af7e0e630c8f92b401012cd2a30ef
NEXT_PUBLIC_GRANTS_ACTIVE_BUCKET_ADDRESS=0x2217E4d3Ae0A6E30075D1B5a7b8C1520E8009f49
NEXT_PUBLIC_GROWTH_BUCKET_ADDRESS=0x420f39968009a0e8693a0e1bba633cd99eaffb9b
NEXT_PUBLIC_GENERAL_BUCKET_ADDRESS=0x72Ed7d7b7835Ad62B1f9b6280bAd62618aA71461
NEXT_PUBLIC_CHAIN_ID=31
10 changes: 5 additions & 5 deletions .github/workflows/dev.deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ on:

env:
AWS_REGION: us-east-1
ECR_REPOSITORY: dao-frontend-dev
ECS_CLUSTER: dao-frontend
ECS_SERVICE: dao-frontend-dev
ECS_TASK_DEFINITION: dao-frontend-dev
CONTAINER_NAME: dao-frontend-dev
ECR_REPOSITORY: rscoll-dev-dao-dev
ECS_CLUSTER: rscoll-dev
ECS_SERVICE: rscoll-dev-dao-dev
ECS_TASK_DEFINITION: rscoll-dev-dao-dev
CONTAINER_NAME: rscoll-dev-dao-dev

PROFILE: dev

Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/staging.deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Deploy to Amazon ECS (staging)

on:
push:
branches:
- develop

env:
AWS_REGION: us-east-1
ECR_REPOSITORY: rscoll-dev-dao-staging
ECS_CLUSTER: rscoll-dev
ECS_SERVICE: rscoll-dev-dao-staging
ECS_TASK_DEFINITION: rscoll-dev-dao-staging
CONTAINER_NAME: rscoll-dev-dao-staging

PROFILE: qa

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
environment:
name: staging

permissions:
id-token: write
contents: read

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_LOGIN_STAGING_ROLE_ARN }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
run: |
# Build a docker container and
# push it to ECR so that it can
# be deployed to ECS.
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG --build-arg arg_env="$PROFILE" --build-arg NEXT_PUBLIC_BUILD_ID=${{ github.sha }} --no-cache .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"

- name: Download task definition
run: aws ecs describe-task-definition --task-definition ${{ env.ECS_TASK_DEFINITION }} --query taskDefinition > task-definition.json

- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: task-definition.json
container-name: ${{ env.CONTAINER_NAME }}
image: ${{ steps.build-image.outputs.image }}

- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: ${{ env.ECS_SERVICE }}
cluster: ${{ env.ECS_CLUSTER }}
wait-for-service-stability: true
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ RUN if [ "$arg_env" = "testnet" ]; then \
mv .env.testnet .env.local; \
elif [ "$arg_env" = "dev" ]; then \
mv .env.dev .env.local; \
elif [ "$arg_env" = "qa" ]; then \
mv .env.qa .env.local; \
elif [ "$arg_env" = "mainnet" ]; then \
mv .env.prod .env.local; \
fi
Expand Down