-
Notifications
You must be signed in to change notification settings - Fork 126
49 lines (41 loc) · 1.5 KB
/
push-ecr-public.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
name: "ElectricEye on ECR Public"
on:
push:
branches: [ master ]
permissions:
id-token: write
contents: read
jobs:
ElectricEyeOnEcrPublic:
runs-on: ubuntu-latest
steps:
# Checkout le branch
- name: Checkout
uses: actions/checkout@v4
# Assume Role via OIDC Provider
- name: Assume AWS Role with OIDC
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.ELECTRIC_EYE_OPENSOURCE_AWS_ACCOUNT_ID }}:role/ElectricEyeOIDCGitHubActionRole
aws-region: us-east-1
# ECR Login to ECR-Public
- name: Amazon ECR Public Login
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@v2
with:
registry-type: public
# Build, Tag, Push to ECR-Public
- name: Build, Tag, Push Image to ECR Public
env:
REGISTRY: ${{ steps.login-ecr-public.outputs.registry }}
REGISTRY_ALIAS: t4o3u7t2
REPOSITORY: electriceye
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG .
docker tag $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:latest
docker push $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG
docker push $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:latest
# Print the location
- name: Print Image
run: echo "$REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG"