-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (41 loc) · 1.54 KB
/
deploy-image.yaml
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
name: "Prod: Build and push docker container"
on:
push:
branches:
- ilt
jobs:
build-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository with submodules
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
submodules: recursive
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ca-central-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build, tag, and push docker image to Amazon ECR
id: push-image
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: common-voice
IMAGE_TAG: prod-${{ github.sha }}
run: |
echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
CURRENT_UID=$(id -u):$(id -g) docker-compose --project-name "common-voice" -f "docker-compose.yaml" build web
docker tag common-voice_web:latest $REGISTRY/$REPOSITORY:$IMAGE_TAG
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG
- name: Repository dispatch to trigger deployment
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.PAT }}
repository: ${{ vars.AWS_REPO }}
event-type: common-voice-deployment
client-payload: '{"tag": "${{ steps.push-image.outputs.image_tag }}"}'