-
-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (44 loc) · 1.55 KB
/
Copy pathdeploy-prd.yml
File metadata and controls
54 lines (44 loc) · 1.55 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
name: Deploy to ECR
on:
push:
branches: [main]
permissions:
id-token: write
contents: read
env:
AWS_REGION: us-east-2
ECR_REPO: thinkfleet-engine
jobs:
build:
name: Build & Push Image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: ${{ env.AWS_REGION }}
- name: Login to ECR
id: ecr-login
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2
- name: Image metadata
id: meta
run: |
TAG="sha-${GITHUB_SHA::8}"
URI="${{ steps.ecr-login.outputs.registry }}/${{ env.ECR_REPO }}:${TAG}"
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
echo "uri=${URI}" >> "$GITHUB_OUTPUT"
- name: Build and push
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6
with:
context: .
push: true
platforms: linux/amd64
tags: |
${{ steps.ecr-login.outputs.registry }}/${{ env.ECR_REPO }}:${{ steps.meta.outputs.tag }}
${{ steps.ecr-login.outputs.registry }}/${{ env.ECR_REPO }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max