Skip to content

Commit 70eaeda

Browse files
committed
Merge branch 'beta' into prod
2 parents b5b18dc + 8bea4b4 commit 70eaeda

19 files changed

+8716
-13970
lines changed

.aws/task-definition-beta-coin.json

Lines changed: 0 additions & 61 deletions
This file was deleted.

.aws/task-definition-beta.json

Lines changed: 0 additions & 61 deletions
This file was deleted.

.aws/task-definition-prod-coin.json

Lines changed: 0 additions & 61 deletions
This file was deleted.

.aws/task-definition-prod.json

Lines changed: 0 additions & 61 deletions
This file was deleted.

.github/workflows/build-main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: install
2323
run: yarn install
2424
- name: build
25-
run: yarn build
25+
run: yarn xy build
2626
# test:
2727
# runs-on: ubuntu-latest
2828
# env:
Lines changed: 57 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
name: Deploy COIN Node Beta
1+
name: Deploy Beta Coin
22

33
on:
44
workflow_dispatch:
55
push:
66
branches:
77
- beta-coin
88

9-
env:
10-
AWS_REGION: us-east-1
11-
CONTAINER_NAME: coin-node
12-
139
jobs:
1410
deploy:
1511
name: Deploy
1612
runs-on: ubuntu-latest
17-
environment: beta-coin
13+
environment:
14+
name: beta
15+
url: ${{ vars.COIN_NODE_URL }}
1816

1917
steps:
20-
- name: Checkout
21-
uses: actions/checkout@v2
18+
- uses: actions/checkout@v3
19+
with:
20+
ref: ${{ github.head_ref }}
21+
fetch-depth: 0
2222

2323
- name: Set up Docker Buildx
2424
id: buildx
@@ -28,46 +28,71 @@ jobs:
2828
[worker.oci]
2929
max-parallelism = 4
3030
31+
- uses: actions/setup-node@v3
32+
with:
33+
node-version: "18"
34+
cache: "yarn"
35+
36+
- name: install
37+
run: yarn install
38+
3139
- name: Configure AWS credentials
32-
uses: aws-actions/configure-aws-credentials@13d241b293754004c80624b5567555c4a39ffbe3
40+
uses: aws-actions/configure-aws-credentials@v4
3341
with:
3442
aws-access-key-id: ${{ secrets.AWS_ECS_DEPLOY_ACCESS_KEY_SELECT }}
3543
aws-secret-access-key: ${{ secrets.AWS_ECS_DEPLOY_SECRET_KEY_SELECT }}
36-
aws-region: ${{ env.AWS_REGION }}
44+
aws-region: ${{ vars.COIN_NODE_AWS_REGION }}
3745

3846
- name: Login to Amazon ECR
3947
id: login-ecr
4048
uses: aws-actions/amazon-ecr-login@aaf69d68aa3fb14c1d5a6be9ac61fe15b48453a2
49+
env:
50+
AWS_REGION: ${{ vars.COIN_NODE_AWS_REGION }}
4151

4252
- name: Build, tag, and push image to Amazon ECR
4353
id: build-image
4454
env:
4555
DOCKER_BUILDKIT: 1
4656
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
57+
ECR_REPOSITORY: ${{ secrets.COIN_NODE_ECR_REPOSITORY }}
4758
IMAGE_TAG: ${{ github.sha }}
4859
run: |
49-
# Build a docker container and
50-
# push it to ECR so that it can
51-
# be deployed to ECS.
52-
docker build -t $ECR_REGISTRY/${{ secrets.ECR_REPOSITORY }}:$IMAGE_TAG .
53-
docker push $ECR_REGISTRY/${{ secrets.ECR_REPOSITORY }}:$IMAGE_TAG
54-
echo "::set-output name=image::$ECR_REGISTRY/${{ secrets.ECR_REPOSITORY }}:$IMAGE_TAG"
60+
docker build -t ${ECR_REGISTRY}/${ECR_REPOSITORY}:${IMAGE_TAG} .
61+
docker push ${ECR_REGISTRY}/${ECR_REPOSITORY}:${IMAGE_TAG}
5562
56-
- name: Fill in the new image ID in the Amazon ECS task definition
57-
id: task-def
58-
uses: aws-actions/amazon-ecs-render-task-definition@374ee96751fffe528c09b5f427848da60469bb55
63+
- name: Install kubectl
64+
uses: azure/setup-kubectl@3e0aec4d80787158d308d7b364cb1b702e7feb7f # v4.0.0
5965
with:
60-
task-definition: .aws/task-definition-beta-coin.json
61-
container-name: ${{ env.CONTAINER_NAME }}
62-
image: ${{ steps.build-image.outputs.image }}
63-
environment-variables: |
64-
AWS_ENV_SECRET_ARN=${{ secrets.AWS_ENV_SECRET_ARN }}
66+
version: latest
6567

66-
- name: Deploy Amazon ECS task definition
67-
# https://github.com/aws-actions/amazon-ecs-deploy-task-definition/releases/tag/v2.1.0
68-
uses: aws-actions/amazon-ecs-deploy-task-definition@4482193dd766379c66473482bbc77299b053ec94 # v2.1.0
69-
with:
70-
task-definition: ${{ steps.task-def.outputs.task-definition }}
71-
service: ${{ secrets.ECS_SERVICE }}
72-
cluster: ${{ secrets.ECS_CLUSTER }}
73-
wait-for-service-stability: true
68+
- name: Set up EKS kubeconfig
69+
run: aws eks update-kubeconfig --name ${{ secrets.COIN_NODE_EKS_CLUSTER_NAME }}
70+
env:
71+
AWS_REGION: ${{ vars.COIN_NODE_AWS_REGION }}
72+
73+
- name: Update Deployment in Kubernetes
74+
env:
75+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
76+
ECR_REPOSITORY: ${{ secrets.COIN_NODE_ECR_REPOSITORY }}
77+
IMAGE_TAG: ${{ github.sha }}
78+
run: |
79+
kubectl --namespace ${{ vars.COIN_NODE_NAMESPACE }} set image deployment/deployment app=$ECR_REGISTRY/${ECR_REPOSITORY}:${IMAGE_TAG}
80+
kubectl --namespace ${{ vars.NAMESPACE }} rollout status deployment/deployment --timeout=5m
81+
82+
- name: invalidate cloudfront distribution and wait for completion
83+
run: |
84+
PATHS=('/' '/*')
85+
INVALIDATION_ID=$(aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --query 'Invalidation.Id' --output text --paths "${PATHS[@]}")
86+
aws cloudfront wait invalidation-completed --distribution-id $DISTRIBUTION_ID --id $INVALIDATION_ID
87+
env:
88+
DISTRIBUTION_ID: ${{ secrets.COIN_NODE_DISTRIBUTION_ID }}
89+
90+
# - name: Notify deploy to Rollbar
91+
# uses: rollbar/github-deploy-action@2.1.2
92+
# id: rollbar_deploy
93+
# with:
94+
# environment: "beta"
95+
# version: ${{ github.sha }}
96+
# env:
97+
# ROLLBAR_ACCESS_TOKEN: ${{ secrets.ROLLBAR_ACCESS_TOKEN }}
98+
# ROLLBAR_USERNAME: ${{ github.actor }}

0 commit comments

Comments
 (0)