Skip to content

UI Workflow

UI Workflow #128

Workflow file for this run

#
# Github Actions for UI
#
name: UI Workflow
on:
workflow_dispatch:
env:
AWS_REGION: eu-west-2
ECR_REGISTRY: 905383583349.dkr.ecr.eu-west-2.amazonaws.com
ECR_REPOSITORY: parimutuel-ui
ECS_TASK_DEFINITION: parimutuel-ui.aws-ecs-task-definition.json
ECS_CLUSTER: parimutuel-services
ECS_SERVICE: parimutuel-ui
CONTAINER_NAME: parimutuel-ui
NODE_VERSION: 14
jobs:
lint_tsc:
name: Run ESLint and Type Check
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
run: npm install
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
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: Copy library from S3
run: |
aws s3 sync s3://trading-view-library/charting_library/ ./public/library/charting_library/
aws s3 sync s3://trading-view-library/datafeeds/ ./public/library/datafeeds/
- name: Linting
run: yarn lint
# - name: Type checking
# run: yarn type-check
build:
needs: lint_tsc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
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: Copy library from S3
run: |
aws s3 sync s3://trading-view-library/charting_library/ ./public/library/charting_library/
aws s3 sync s3://trading-view-library/datafeeds/ ./public/library/datafeeds/
- name: Login to Public ECR
uses: docker/login-action@v1
with:
registry: ${{ env.ECR_REGISTRY }}
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
env:
AWS-REGION: ${{ env.AWS_REGION }}
- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
IMAGE_TAG: latest
run: |
# Build a docker container and push it to ECR
docker build -f ui.Dockerfile -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
- name: Create / Update Task Definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@97587c9d45a4930bf0e3da8dd2feb2a463cf4a3a
with:
task-definition: ${{ env.ECS_TASK_DEFINITION }}
container-name: ${{ env.CONTAINER_NAME }}
image: ${{ steps.build-image.outputs.image }}
- name: Deploy Amazon ECS task definition
uses: aws-actions/[email protected]
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: ${{ env.ECS_SERVICE }}
cluster: ${{ env.ECS_CLUSTER }}
wait-for-service-stability: true