Merge pull request #25 from terraswap/fix/sperated-wasm #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Collector | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "src/dashboard/**" | |
- "src/graphql/**" | |
env: | |
AWS_REGION: ${{ secrets.COLLECTOR_AWS_REGION }} | |
ECR_REPOSITORY: terraswap-graph | |
ECS_CLUSTER: terraswap-graph | |
# terra mainnet | |
PHOENIX_ECS_SERVICE: phoenix-terraswap-graph-collector | |
PHOENIX_TASK_DEFINITION: phoenix-terraswap-graph-collector | |
PHOENIX_CONTAINER_NAME: phoenix-terraswap-graph-collector | |
# terra classic | |
COLUMBUS_ECS_SERVICE: columbus-terraswap-graph-collector | |
COLUMBUS_TASK_DEFINITION: columbus-terraswap-graph-collector | |
COLUMBUS_CONTAINER_NAME: columbus-terraswap-graph-collector | |
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-collector: | |
name: Deploy Phoenix Collector | |
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-collector: | |
name: Deploy Columbus Collector | |
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 |