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

feat: add collective rewards #279

Merged
merged 72 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
da45c20
TOK-193: Verify if we can work around CORS restrictions to run the dA…
jurajpiar Aug 7, 2024
8f21bda
TOK-194: Run the dapp in Regtest (#4)
jurajpiar Aug 14, 2024
32c831e
Sync upstream develop (#7)
antomor Aug 29, 2024
e1b79e2
TOK-198: basic bim view (#6)
jurajpiar Aug 29, 2024
0c6a878
TOK-223: Setup unit tests (#8)
antomor Aug 29, 2024
39302fb
TOK-213: add metrics section (#9)
antomor Sep 4, 2024
d1fbd71
TOK-211/builders whitelist (#11)
antomor Sep 6, 2024
cf9560d
TOK-222: add search/sort functionalities to whitelisted builders (#12)
antomor Sep 6, 2024
bc39432
TOK-214/become-builder-button (#14)
franciscotobar Sep 9, 2024
f5590a7
TOK-212: add leaderboard (#13)
antomor Sep 9, 2024
addcdc8
TOK-228/become-builder-modal (#16)
franciscotobar Sep 17, 2024
77fafff
TOK-226/holding-rewards-tab (#17)
franciscotobar Sep 18, 2024
28e8c69
feat: implement cd for bim-dao-frontend qa (#15)
david-iov Sep 19, 2024
209456f
TOK-253: add bim proposal fetching (#18)
jurajpiar Sep 19, 2024
5ea793d
fix(runtime): load endpoints from config (#21)
jurajpiar Sep 19, 2024
163d863
fix: renames mock files to match vars (#24)
jurajpiar Sep 24, 2024
51fed4e
Sync upstream develop (#25)
jurajpiar Sep 24, 2024
ed33623
fix: upstream issues (#27)
jurajpiar Sep 24, 2024
5a319af
chore: adds hotfix from upstream (#29)
jurajpiar Sep 25, 2024
3dca468
fix(cd): change profile to testnet (#30)
jurajpiar Sep 30, 2024
5037975
feat: Adds BIM Proposal form (#22)
jurajpiar Oct 1, 2024
8730dec
feat(bim): my rewards view (#23)
franciscotobar Oct 1, 2024
874239a
feat(bim): on chain builders (#28)
franciscotobar Oct 2, 2024
875ead7
TOK-294: show rewards tab just for whitelisted builders (#34)
franciscotobar Oct 4, 2024
f13feb3
TOK-290: builders proposals display (#33)
franciscotobar Oct 4, 2024
37f385c
feat(bim): allows builder dewhitelist (#32)
jurajpiar Oct 4, 2024
793b974
fix(bim): become a builder button status (#35)
franciscotobar Oct 7, 2024
65c25da
chore(cd): deploy staging on tag (#37)
jurajpiar Oct 8, 2024
2838e54
TOK-296: wrap proposal and description text (#36)
franciscotobar Oct 8, 2024
5460b5c
TOK-283: deploy to qa by manual trigger (#39)
jurajpiar Oct 9, 2024
d08329e
fix(bim): fiat values rewards tab (#41)
franciscotobar Oct 9, 2024
9eab96d
TOK-306: Merge upstream (#45)
antomor Oct 14, 2024
d91c14f
TOK-300: legal review (#40)
franciscotobar Oct 14, 2024
a9c3b28
TOK-302: disclaimer modal (#46)
franciscotobar Oct 14, 2024
02603d9
chore(config): update testnet contract addresses (#43)
jurajpiar Oct 15, 2024
edc0ff2
fix(bim): handle errors (#44)
jurajpiar Oct 15, 2024
ebacc1d
TOK-304: update qa contracts (#54)
antomor Oct 16, 2024
e394a49
fix(bim): whitelist and leaderboard sections (#52)
franciscotobar Oct 16, 2024
35826c4
fix(bim): my rewards style (#50)
franciscotobar Oct 16, 2024
9155a74
fix(bim): become a builder and disclaimer modals (#51)
franciscotobar Oct 16, 2024
0cb746f
TOK-321: adapt builder status badge (#53)
jurajpiar Oct 16, 2024
53f9cd0
TOK-320: proposal type modal (#48)
franciscotobar Oct 17, 2024
f5507ea
TOK-325: create proposals with steps (#55)
franciscotobar Oct 17, 2024
13b3a83
chore: modify disclaimer wording (#59)
jurajpiar Oct 17, 2024
3c10daf
chore: upstream sync (#58)
jurajpiar Oct 17, 2024
27ad374
fix(bim): proposal types names and descriptions (#63)
franciscotobar Oct 18, 2024
292570b
TOK-332: use governor relay method (#57)
antomor Oct 19, 2024
53da340
fix(bim): can create proposal (#60)
franciscotobar Oct 19, 2024
650e80a
TOK-334: builder name (#61)
franciscotobar Oct 19, 2024
f0dae21
fix: buttons and proposal actions ui (#65)
jurajpiar Oct 19, 2024
41c4b10
TOK-328: adapts leaderboard to new design (#62)
jurajpiar Oct 19, 2024
23121bd
FIX(CD QA): fix aws role (#67)
antomor Oct 21, 2024
438288c
TOK-347: proposals type and description (#69)
franciscotobar Oct 22, 2024
a5a6c58
fix: rbtc rewards, last cycle rewards and 8 decimals (#70)
franciscotobar Oct 22, 2024
75bdbda
TOK-340: builder avatar (#66)
franciscotobar Oct 22, 2024
c605fd0
ci: fix aws role (#75)
antomor Oct 23, 2024
ea9fc8f
feat: update become builder modal (#72)
jurajpiar Oct 23, 2024
1b568b9
TOK-316: rewording (#74)
franciscotobar Oct 23, 2024
2593242
feat(bim): adds static projected reward (#77)
jurajpiar Oct 23, 2024
cc6998a
Merge remote-tracking branch 'origin/develop' into upstream_sync
jurajpiar Oct 24, 2024
f2bc934
fix(bim): remove dependency
franciscotobar Oct 24, 2024
75dbf88
fix: clears up merge inconsistencies
jurajpiar Oct 24, 2024
2fc2680
fix(bim): lowercase address
franciscotobar Oct 24, 2024
24f5638
fix: postmerge CD fixes
jurajpiar Oct 24, 2024
10f365d
fix(token_format): incorrect end bracket placement
jurajpiar Oct 24, 2024
88ceeb2
ci(CR): update staging envs
antomor Oct 24, 2024
3a200dd
fix(bim): last cycle rewards
franciscotobar Oct 24, 2024
07a4c3f
fix: return testnet.deploy.yaml
jurajpiar Oct 25, 2024
de388ab
fix: wrapps err in useEffect
jurajpiar Oct 25, 2024
99cb93e
refactor: move CopySvg to own file
jurajpiar Oct 25, 2024
777f4fa
fix: adds CR config to DAO env files
jurajpiar Oct 25, 2024
ae4b917
fix: bim envs
jurajpiar Oct 25, 2024
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
9 changes: 8 additions & 1 deletion .env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,11 @@ 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
NEXT_PUBLIC_CHAIN_ID=31

# CR-related env variables
NEXT_PUBLIC_SIMPLIFIED_REWARD_DISTRIBUTOR_ADDRESS=0x4447EC87854651ECdce3E91e581c34641C91eC46
NEXT_PUBLIC_EPOCH_DURATION_IN_DAYS=7
NEXT_PUBLIC_FIRST_EPOCH_START_DATE_ISO="1970-01-01T00:00:00Z"

NEXT_PUBLIC_ENV_DATA_URL="https://raw.githubusercontent.com/RootstockCollective/dao-frontend/develop/data.testnet.json"
7 changes: 7 additions & 0 deletions .env.prod
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,10 @@ NEXT_PUBLIC_GRANTS_ACTIVE_BUCKET_ADDRESS=0xf016fa6b237bb56e3aee7022c6947a6a103e3
NEXT_PUBLIC_GROWTH_BUCKET_ADDRESS=0x267a6073637408b6A1d34d685ff5720A0CbCbD9d
NEXT_PUBLIC_GENERAL_BUCKET_ADDRESS=0xfE3d9B7D68aE13455475F28089968336414FD358
NEXT_PUBLIC_CHAIN_ID=30

# BIM-related env variables
NEXT_PUBLIC_SIMPLIFIED_REWARD_DISTRIBUTOR_ADDRESS=0x0000000000000000000000000000000000000000
NEXT_PUBLIC_EPOCH_DURATION_IN_DAYS=0
NEXT_PUBLIC_FIRST_EPOCH_START_DATE_ISO="1970-01-01T00:00:00Z"

NEXT_PUBLIC_ENV_DATA_URL="https://raw.githubusercontent.com/RootstockCollective/dao-frontend/develop/data.mainnet.json"
10 changes: 9 additions & 1 deletion .env.qa
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,12 @@ 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
NEXT_PUBLIC_CHAIN_ID=31

# CR-related env variables
NEXT_PUBLIC_SIMPLIFIED_REWARD_DISTRIBUTOR_ADDRESS=0xc469Cc2579De5C16210e9063B4E628bF8C46bA02
NEXT_PUBLIC_EPOCH_DURATION_IN_DAYS=7
NEXT_PUBLIC_FIRST_EPOCH_START_DATE_ISO="1970-01-01T00:00:00Z"
NEXT_PUBLIC_WHITELISTED_BUILDERS_URL=https://frontend.qa.bim.dao.rif.technology/bim/whitelisted/

NEXT_PUBLIC_ENV_DATA_URL="https://raw.githubusercontent.com/RootstockCollective/dao-frontend/develop/data.testnet.qa.json"
24 changes: 24 additions & 0 deletions .env.regtest
jurajpiar marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This file contains the environment variables for the CR regtest environment
NEXT_PUBLIC_ENV=regtest
NEXT_PUBLIC_RIF_WALLET_SERVICES=http://localhost:3000/mock
NEXT_PUBLIC_EXPLORER=/mock
NEXT_PUBLIC_BUILD_ID=

NEXT_PUBLIC_RIF_ADDRESS=0x19f64674d8a5b4e652319f5e239efd3bc969a1fe
NEXT_PUBLIC_STRIF_ADDRESS=0xAF17f7A0124E9F360ffA484b13566b041C0f5023
NEXT_PUBLIC_GOVERNOR_ADDRESS=0xEc6bd0C8117b74904849af2CED73f30090DB6cd1
NEXT_PUBLIC_EA_NFT_ADDRESS=0x687E04Bb759B3A010eb797301E5D1D05e135E90f
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=33

REGTEST_URL=http://localhost:4444
# CR-related env variables
NEXT_PUBLIC_SIMPLIFIED_REWARD_DISTRIBUTOR_ADDRESS=0x2E8924AAa43A9544A058E6f97D2d7a80a5266c28
NEXT_PUBLIC_CYCLE_DURATION_IN_DAYS=7
NEXT_PUBLIC_FIRST_CYCLE_START_DATE_ISO="1970-01-01T00:00:00Z"

NEXT_PUBLIC_ENV_DATA_URL="https://raw.githubusercontent.com/RootstockCollective/dao-frontend/develop/data.regtest.json"
7 changes: 7 additions & 0 deletions .env.testnet
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,10 @@ NEXT_PUBLIC_GRANTS_ACTIVE_BUCKET_ADDRESS=0x2217E4d3Ae0A6E30075D1B5a7b8C1520E8009
NEXT_PUBLIC_GROWTH_BUCKET_ADDRESS=0x420f39968009a0e8693a0e1bba633cd99eaffb9b
NEXT_PUBLIC_GENERAL_BUCKET_ADDRESS=0x72Ed7d7b7835Ad62B1f9b6280bAd62618aA71461
NEXT_PUBLIC_CHAIN_ID=31

# CR-related env variables
NEXT_PUBLIC_SIMPLIFIED_REWARD_DISTRIBUTOR_ADDRESS=0x4447EC87854651ECdce3E91e581c34641C91eC46
jurajpiar marked this conversation as resolved.
Show resolved Hide resolved
NEXT_PUBLIC_EPOCH_DURATION_IN_DAYS=7
NEXT_PUBLIC_FIRST_EPOCH_START_DATE_ISO="1970-01-01T00:00:00Z"

NEXT_PUBLIC_ENV_DATA_URL="https://raw.githubusercontent.com/RootstockCollective/dao-frontend/develop/data.testnet.json"
24 changes: 24 additions & 0 deletions .env.testnet.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This file contains the environment variables for the CR local testnet environment
NEXT_PUBLIC_ENV=testnet
NEXT_PUBLIC_RIF_WALLET_SERVICES=http://localhost:3000/cors_bypass
NEXT_PUBLIC_PROXY_DESTINATION=https://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=0x4861198e9A6814EBfb152552D1b1a37426C54D23
NEXT_PUBLIC_GOVERNOR_ADDRESS=0x2109FF4a9D5548a21F877cA937Ac5847Fde49694
NEXT_PUBLIC_EA_NFT_ADDRESS=0x979deF73ec80B8AE24Ae46765b81D9aF7b1C9327
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

# CR-related env variables
NEXT_PUBLIC_SIMPLIFIED_REWARD_DISTRIBUTOR_ADDRESS=0x4e84FCc953dE129C6C47c5B0AD7E57B226093Ae1
NEXT_PUBLIC_EPOCH_DURATION_IN_DAYS=7
NEXT_PUBLIC_FIRST_EPOCH_START_DATE_ISO="1970-01-01T00:00:00Z"

NEXT_PUBLIC_ENV_DATA_URL="https://raw.githubusercontent.com/RootstockCollective/dao-frontend/develop/data.testnet.local.json"
25 changes: 25 additions & 0 deletions .env.testnet.qa
jurajpiar marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This file contains the environment variables for the CR QA testnet environment
NEXT_PUBLIC_ENV=testnet
NEXT_PUBLIC_RIF_WALLET_SERVICES=https://frontend.qa.bim.dao.rif.technology/cors_bypass
NEXT_PUBLIC_PROXY_DESTINATION=https://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=0xC4b091d97AD25ceA5922f09fe80711B7ACBbb16f
NEXT_PUBLIC_GOVERNOR_ADDRESS=0xB1A39B8f57A55d1429324EEb1564122806eb297F
NEXT_PUBLIC_EA_NFT_ADDRESS=0x979deF73ec80B8AE24Ae46765b81D9aF7b1C9327
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

# CR-related env variables
NEXT_PUBLIC_SIMPLIFIED_REWARD_DISTRIBUTOR_ADDRESS=0xc469Cc2579De5C16210e9063B4E628bF8C46bA02
NEXT_PUBLIC_EPOCH_DURATION_IN_DAYS=7
NEXT_PUBLIC_FIRST_EPOCH_START_DATE_ISO="1970-01-01T00:00:00Z"
NEXT_PUBLIC_WHITELISTED_BUILDERS_URL=https://frontend.qa.bim.dao.rif.technology/bim/whitelisted/

NEXT_PUBLIC_ENV_DATA_URL="https://raw.githubusercontent.com/RootstockCollective/dao-frontend/develop/data.testnet.qa.json"
25 changes: 25 additions & 0 deletions .env.testnet.staging
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This file contains the environment variables for the CR staging testnet environment
NEXT_PUBLIC_ENV=testnet
NEXT_PUBLIC_RIF_WALLET_SERVICES=https://frontend.testnet.bim.dao.rif.technology/cors_bypass
NEXT_PUBLIC_PROXY_DESTINATION=https://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=0x4861198e9A6814EBfb152552D1b1a37426C54D23
NEXT_PUBLIC_GOVERNOR_ADDRESS=0x2109FF4a9D5548a21F877cA937Ac5847Fde49694
NEXT_PUBLIC_EA_NFT_ADDRESS=0x979deF73ec80B8AE24Ae46765b81D9aF7b1C9327
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

# CR-related env variables
NEXT_PUBLIC_SIMPLIFIED_REWARD_DISTRIBUTOR_ADDRESS=0x4447EC87854651ECdce3E91e581c34641C91eC46
NEXT_PUBLIC_EPOCH_DURATION_IN_DAYS=7
NEXT_PUBLIC_FIRST_EPOCH_START_DATE_ISO="1970-01-01T00:00:00Z"
NEXT_PUBLIC_WHITELISTED_BUILDERS_URL=https://frontend.testnet.bim.dao.rif.technology/bim/whitelisted/

NEXT_PUBLIC_ENV_DATA_URL="https://raw.githubusercontent.com/RootstockCollective/dao-frontend/develop/data.testnet.staging.json"
74 changes: 74 additions & 0 deletions .github/workflows/cr.qa.deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Deploy to Amazon ECS (CR QA)

on:
workflow_dispatch: # Manually triggered from GitHub Actions tab
pull_request:
types: [labeled] # Triggered by a label in a PR

env:
AWS_REGION: us-east-1
ECR_REPOSITORY: bim-dao-frontend-qa
ECS_SERVICE: bim-dao-frontend
ECS_CLUSTER: bim-dao-frontend-qa
ECS_TASK_DEFINITION: bim-dao-frontend-qa
CONTAINER_NAME: bim-dao-frontend

PROFILE: testnet.qa
jurajpiar marked this conversation as resolved.
Show resolved Hide resolved

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
if: |
github.event_name == 'workflow_dispatch' || github.event.label.name == 'deploy to QA'
environment:
name: QA
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.ROLE_ECS_ARN }}
aws-region: ${{ env.AWS_REGION }}

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

- 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
74 changes: 74 additions & 0 deletions .github/workflows/cr.staging.deploy.yaml
jurajpiar marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Deploy to Amazon ECS (CR STAGING)

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+'

env:
AWS_REGION: us-east-1
ECR_REPOSITORY: bim-dao-frontend-testnet
ECS_SERVICE: bim-dao-frontend
ECS_CLUSTER: bim-dao-frontend-testnet
ECS_TASK_DEFINITION: bim-dao-frontend-testnet
CONTAINER_NAME: bim-dao-frontend

PROFILE: testnet.staging

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
environment:
name: TESTNET
permissions:
id-token: write
contents: read

steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}

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

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

- 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
15 changes: 15 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Unit tests

on: push

jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Install modules
run: yarn

- name: Run tests
run: yarn test
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ENV NEXT_TELEMETRY_DISABLED 1
ARG arg_env
ARG NEXT_PUBLIC_BUILD_ID

# Rename environment files based on arg_env
# Rename environment files based on arg_env TODO: This is silly to do just for the sake of one file name (.env.prod) if we could replace this monster with `mv ".env.$arg_env". .env.local`. Furthermore, PROFILE var should work just as well ;)
RUN if [ "$arg_env" = "testnet" ]; then \
mv .env.testnet .env.local; \
elif [ "$arg_env" = "dev" ]; then \
Expand All @@ -32,6 +32,10 @@ RUN if [ "$arg_env" = "testnet" ]; then \
mv .env.qa .env.local; \
elif [ "$arg_env" = "mainnet" ]; then \
mv .env.prod .env.local; \
elif [ "$arg_env" = "testnet.qa"]; then \
mv .env.testnet.qa .env.local
elif [ "$arg_env" = "testnet.staging"]; then \
mv .env.testnet.staging .env.local
fi

# Export the NEXT_PUBLIC_BUILD_ID as an environment variable
Expand Down
Loading
Loading