-
Notifications
You must be signed in to change notification settings - Fork 3
72 lines (59 loc) · 2.04 KB
/
deploy-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
---
name: Deploy Production
on:
push:
branches:
- master
workflow_dispatch: {}
jobs:
Publish:
runs-on: ubuntu-latest
steps:
- name: Configure
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.PRODUCTION_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.PRODUCTION_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.PRODUCTION_AWS_REGION }}
- name: Authenticate
id: authenticate
uses: aws-actions/amazon-ecr-login@v1
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Publish
id: publish
env:
ECR_REPOSITORY: ${{ secrets.PRODUCTION_AWS_ECR_REPOSITORY }}
IMAGE_TAG: ${{ github.sha }}
run: |
docker build \
--build-arg BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
--build-arg VCS_REF=$IMAGE_TAG \
--build-arg VERSION=$IMAGE_TAG \
--tag $ECR_REPOSITORY:$IMAGE_TAG \
.
docker push $ECR_REPOSITORY:$IMAGE_TAG
docker tag $ECR_REPOSITORY:$IMAGE_TAG $ECR_REPOSITORY:latest
docker push $ECR_REPOSITORY:latest
echo "::set-output name=image::$ECR_REPOSITORY:$IMAGE_TAG"
- name: Grab
run: |
aws ecs describe-task-definition \
--task-definition ${{ secrets.PRODUCTION_AWS_TASK_DEFINITION }} \
--query taskDefinition > /tmp/task.json
- name: Template
id: template
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: /tmp/task.json
container-name: app
image: ${{ steps.publish.outputs.image }}
- name: Deploy
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.template.outputs.task-definition }}
service: production-system76-recognizer
cluster: system76-us-east-2
wait-for-service-stability: true