Skip to content

Merge pull request #13 from terraswap/hotfix/classic-latest-block-path #11

Merge pull request #13 from terraswap/hotfix/classic-latest-block-path

Merge pull request #13 from terraswap/hotfix/classic-latest-block-path #11

Workflow file for this run

name: Dashboard server
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- "src/collector/**"
- "src/graphql/**"
env:
AWS_REGION: ${{ secrets.AWS_REGION }}
ECR_REPOSITORY: terraswap-graph
ECS_CLUSTER: terraswap-graph
# terra mainnet
PHOENIX_ECS_SERVICE: phoenix-terraswap-graph-dashboard
PHOENIX_TASK_DEFINITION: phoenix-terraswap-graph-dashboard
PHOENIX_CONTAINER_NAME: phoenix-terraswap-graph-dashboard
# terra classic
COLUMBUS_ECS_SERVICE: columbus-terraswap-graph-dashboard
COLUMBUS_TASK_DEFINITION: columbus-terraswap-graph-dashboard
COLUMBUS_CONTAINER_NAME: columbus-terraswap-graph-dashboard
jobs:
build:
name: build terraswap-graph image
runs-on: ubuntu-latest
environment: production
outputs:
image-tag: ${{ steps.build-image.outputs.image-tag }}
steps:
- name: checkout
uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/[email protected]
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/[email protected]
- name: Build, tag, and push image to Amazon ECR
id: build-image
working-directory: .
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker image push -a $ECR_REGISTRY/$ECR_REPOSITORY
echo "image-tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
deploy-phoenix-dashboard:
name: Deploy Phoenix Dashboard
runs-on: ubuntu-latest
needs: build
environment: production
steps:
- name: Configure AWS credentials
uses: aws-actions/[email protected]
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/[email protected]
- name: Download Task Definition
id: download-task-definition
working-directory: .
run: |
aws ecs describe-task-definition --task-definition ${{ env.PHOENIX_TASK_DEFINITION }} | jq '.taskDefinition' > ${{ env.PHOENIX_TASK_DEFINITION }}.json
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/[email protected]
with:
task-definition: ./${{ env.PHOENIX_TASK_DEFINITION }}.json
container-name: ${{ env.PHOENIX_CONTAINER_NAME }}
image: ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY}}:${{ needs.build.outputs.image-tag }}
- name: Deploy Amazon ECS task definition
uses: aws-actions/[email protected]
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: ${{ env.PHOENIX_ECS_SERVICE }}
cluster: ${{ env.ECS_CLUSTER }}
wait-for-service-stability: true
deploy-columbus-dashboard:
name: Deploy Columbus Dashboard
runs-on: ubuntu-latest
needs: build
environment: production
steps:
- name: Configure AWS credentials
uses: aws-actions/[email protected]
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/[email protected]
- name: Download Task Definition
id: download-task-definition
working-directory: .
run: |
aws ecs describe-task-definition --task-definition ${{ env.COLUMBUS_TASK_DEFINITION }} | jq '.taskDefinition' > ${{ env.COLUMBUS_TASK_DEFINITION }}.json
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/[email protected]
with:
task-definition: ./${{ env.COLUMBUS_TASK_DEFINITION }}.json
container-name: ${{ env.COLUMBUS_CONTAINER_NAME }}
image: ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY}}:${{ needs.build.outputs.image-tag }}
- name: Deploy Amazon ECS task definition
uses: aws-actions/[email protected]
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: ${{ env.COLUMBUS_ECS_SERVICE }}
cluster: ${{ env.ECS_CLUSTER }}
wait-for-service-stability: true