-
Notifications
You must be signed in to change notification settings - Fork 1
82 lines (70 loc) · 2.52 KB
/
release-production.yml
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
80
81
82
name: Release (Production)
on:
push:
tags:
- 'v*.*.*'
env:
AWS_REGION: us-east-1
ECS_CLUSTER: howdi
DEMO_ECS_SERVICE: chatkitty-demo
DEMO_CONTAINER_NAME: demo
DEMO_ECS_TASK_DEFINITION: .github/workflows/files/demo-production-task-definition.json
jobs:
release-demo:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Use Node 16.x
uses: actions/setup-node@v2
with:
node-version: '16.x'
cache: 'yarn'
cache-dependency-path: yarn.lock
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- 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: Build React application
run: |
yarn install --frozen-lockfile;
yarn run build;
- name: Generate image tags
id: image-tags
run: |
echo "::set-output name=release-version-tag::$(git rev-parse --short HEAD)";
echo "::set-output name=image-tag::howdi/chatkitty-website:$(git describe --tags)";
- name: Build and push Docker image
id: docker-build
uses: docker/build-push-action@v2
with:
context: ./
file: ./docker/Dockerfile
push: true
tags: ${{ steps.image-tags.outputs.image-tag }}
cache-from: type=gha, scope=${{ github.workflow }}
cache-to: type=gha, scope=${{ github.workflow }}
- name: Fill out ECS task definition
id: task-definition
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: ${{ env.DEMO_ECS_TASK_DEFINITION }}
container-name: ${{ env.DEMO_CONTAINER_NAME }}
image: ${{ steps.image-tags.outputs.image-tag }}
- name: Deploy ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-definition.outputs.task-definition }}
service: ${{ env.DEMO_ECS_SERVICE }}
cluster: ${{ env.ECS_CLUSTER }}
wait-for-service-stability: true