-
Notifications
You must be signed in to change notification settings - Fork 20
53 lines (51 loc) · 1.69 KB
/
container-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
48
49
50
51
52
53
name: Container Images
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
env:
REGION : "us-east-1"
jobs:
build:
# this is to prevent the job to run at forked projects
if: github.repository == 'awslabs/aws-s3-csi-driver'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@master
with:
role-to-assume: arn:aws:iam::211164257204:role/S3CSIDriverPrivateImagePublisherRole # TODO: replace with a role with access to the public registry
aws-region: ${{ env.REGION }}
# - name: Login to Amazon ECR Public
# id: login-ecr-public
# uses: aws-actions/amazon-ecr-login@v2
# with:
# registry-type: public
- 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 Public Repository
env:
REGISTRY: ${{ steps.login-ecr-public.outputs.registry }}
run: |
BRANCH_OR_TAG=$(echo $GITHUB_REF | cut -d'/' -f3)
if [ "$BRANCH_OR_TAG" = "main" ]; then
GIT_TAG=$GITHUB_SHA
else
GIT_TAG=$BRANCH_OR_TAG
fi
export PLATFORM=linux/amd64
export TAG=$GIT_TAG
make build_image
make push_image