Skip to content

fix: exmaple.config #18

fix: exmaple.config

fix: exmaple.config #18

Workflow file for this run

name: Deploy Terraswap Service
on:
workflow_dispatch:
push:
branches:
- main
env:
AWS_REGION: ${{ secrets.AWS_REGION }}
ECR_REPOSITORY: terraswap-service
ECS_CLUSTER: terraswap-service
PHOENIX_ECS_SERVICE: phoenix-terraswap-service
PHOENIX_TASK_DEFINITION: phoenix-terraswap-service
PHOENIX_CONTAINER_NAME: phoenix-terraswap-service
PISCO_ECS_SERVICE: pisco-terraswap-service
PISCO_TASK_DEFINITION: pisco-terraswap-service
PISCO_CONTAINER_NAME: pisco-terraswap-service
COLUMBUS_ECS_SERVICE: columbus-terraswap-service
COLUMBUS_TASK_DEFINITION: columbus-terraswap-service
COLUMBUS_CONTAINER_NAME: columbus-terraswap-service
COLUMBUS_V1_ECS_SERVICE: columbus-v1-terraswap-service
COLUMBUS_V1_TASK_DEFINITION: columbus-v1-terraswap-service
COLUMBUS_V1_CONTAINER_NAME: columbus-v1-terraswap-service
jobs:
build:
name: build terraswap-service image
runs-on: ubuntu-latest
environment: production
outputs:
phoenix-tag: ${{ steps.build-image.outputs.phoenix-tag }}
pisco-tag: ${{ steps.build-image.outputs.pisco-tag }}
columbus-tag: ${{ steps.build-image.outputs.columbus-tag }}
columbus-v1-tag: ${{ steps.build-image.outputs.columbus-v1-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: Test, build, tag, and push image to Amazon ECR
id: build-image
working-directory: .
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
PHOENIX_CONFIG: ${{ secrets.PHOENIX_CONFIG }}
PISCO_CONFIG: ${{ secrets.PISCO_CONFIG }}
COLUMBUS_CONFIG: ${{ secrets.COLUMBUS_CONFIG }}
COLUMBUS_V1_CONFIG: ${{ secrets.COLUMBUS_V1_CONFIG }}
run: |
make test
IMAGE_TAG=`git rev-parse --short HEAD`
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
echo "FROM $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
COPY config.yaml /app/config.yaml" > Dockerfile.final
configs=("$PHOENIX_CONFIG" "$PISCO_CONFIG" "$COLUMBUS_CONFIG" "$COLUMBUS_V1_CONFIG")
networks=("phoenix" "pisco" "columbus" "columbus-v1")
for i in "${!configs[@]}"; do
echo "${configs[i]}" > config.yaml
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:${networks[i]}-$IMAGE_TAG -f Dockerfile.final .
echo "${networks[i]}-tag=${networks[i]}-$IMAGE_TAG" >> $GITHUB_OUTPUT
done
docker image push -a $ECR_REGISTRY/$ECR_REPOSITORY
deploy-phoenix:
name: Deploy Phoenix
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.phoenix-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-pisco:
name: Deploy Pisco
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.PISCO_TASK_DEFINITION }} | jq '.taskDefinition' > ${{ env.PISCO_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.PISCO_TASK_DEFINITION }}.json
container-name: ${{ env.PISCO_CONTAINER_NAME }}
image: ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY}}:${{ needs.build.outputs.pisco-tag }}
- name: Deploy Amazon ECS task definition
uses: aws-actions/[email protected]
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: ${{ env.PISCO_ECS_SERVICE }}
cluster: ${{ env.ECS_CLUSTER }}
wait-for-service-stability: true
deploy-columbus:
name: Deploy Columbus
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.columbus-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
deploy-v1-columbus:
name: Deploy Columbus V1
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_V1_TASK_DEFINITION }} | jq '.taskDefinition' > ${{ env.COLUMBUS_V1_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_V1_TASK_DEFINITION }}.json
container-name: ${{ env.COLUMBUS_V1_TASK_DEFINITION }}
image: ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY}}:${{ needs.build.outputs.columbus-v1-tag }}
- name: Deploy Amazon ECS task definition
uses: aws-actions/[email protected]
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: ${{ env.COLUMBUS_V1_TASK_DEFINITION }}
cluster: ${{ env.ECS_CLUSTER }}
wait-for-service-stability: true