-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (42 loc) · 1.38 KB
/
prime-generator-python.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
48
name: Deploy to Amazon ECS
on:
push:
branches:
- main
paths:
- 'apps/prime-generator-python/**'
- '.github/workflows/**'
env:
ECR_REPOSITORY: prime_generator_python
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
environment: dev
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.GH_ACTIONS_IAM_ROLE }}
role-session-name: GHActionsOIDC
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
working-directory: apps/prime-generator-python
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:latest -f .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:latest >> $GITHUB_OUTPUT