Added 1 token/s: undefined #726
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: api-polygon-tokens-ecs | |
on: | |
push: | |
branches: ['master'] | |
workflow_dispatch: | |
jobs: | |
deploy: | |
name: api-polygon-tokens-prod-ecs | |
permissions: | |
id-token: write | |
contents: write | |
environment: prod | |
runs-on: ubuntu-latest | |
env: | |
AWS_REGION: eu-west-1 | |
ECR_REPOSITORY: api-polygon-tokens-ecr | |
ECS_SERVICE: api-polygon-tokens-ecs-service | |
ECS_CLUSTER: frontend-prod-ecs-cluster | |
ECS_TASK_DEFINITION: prod-taskdef.json | |
CONTAINER_NAME: api-polygon-tokens | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v2 | |
# Runs a set of commands using the runners shell | |
- name: Install dependencies | |
run: npm ci | |
- name: Build tokenlists | |
run: npm run build | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-region: ${{ env.AWS_REGION }} | |
role-to-assume: arn:aws:iam::042947190491:role/api-polygon-tokens-GithubActionsRole | |
role-session-name: GithubActionsSession | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Build, tag, and push image to Amazon ECR | |
id: build-image | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
IMAGE_TAG: ${{ github.sha }} | |
run: | | |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . | |
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | |
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT | |
- name: Fill in the new image ID in the Amazon ECS task definition | |
id: task-def | |
uses: aws-actions/amazon-ecs-render-task-definition@v1 | |
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/amazon-ecs-deploy-task-definition@v1 | |
with: | |
task-definition: ${{ steps.task-def.outputs.task-definition }} | |
service: ${{ env.ECS_SERVICE }} | |
cluster: ${{ env.ECS_CLUSTER }} | |
wait-for-service-stability: true | |
- name: Cloudflare Cache Purge | |
uses: nathanvaughn/actions-cloudflare-purge@master | |
with: | |
cf_zone: ${{ secrets.CLOUDFLARE_ZONE }} | |
cf_auth: ${{ secrets.CLOUDFLARE_API_KEY }} | |
hosts: api-polygon-tokens.polygon.technology |