This repository was archived by the owner on Dec 22, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
79 lines (66 loc) · 2.69 KB
/
Copy pathci.yml
File metadata and controls
79 lines (66 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: CI
on:
push:
branches:
- main
jobs:
ci:
name: Build and Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Installing dependencies
run: yarn install
- name: Package
run: yarn dist
- name: Read .env File
id: dotenv
uses: falti/dotenv-action@v0.2
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: ${{steps.dotenv.outputs.terraform_version}}
- name: Terraform Init
id: init
run: terraform init -no-color
working-directory: ./terraform
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Terraform Apply
id: apply
run: terraform apply -auto-approve -no-color
working-directory: ./terraform
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- 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: us-east-1
- name: ECR Login
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Docker Build & ECR Push
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: techpivot-streaming-slack-notify-ecr
NODE_VERSION: ${{steps.dotenv.outputs.node_version }}
run: |
docker build --platform linux/arm64 --build-arg DOCKER_REPO="arm64v8/node" --build-arg NODE_VERSION=$NODE_VERSION -t $ECR_REGISTRY/$ECR_REPOSITORY:${{ github.sha }} -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags
# Technically this won't work since we don't expose excess capacity from spot fleet + task def
aws ecs update-service --cluster techpivot-streaming-slack-notify-ecs-cluster --service techpivot-streaming-slack-notify-ecs-service --force-new-deployment