make REGISTRY env available for the make command #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} | |
REGISTRY: ${{ steps.login-ecr.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 | |
echo $REGISTRY | |
export PLATFORM=linux/amd64 | |
export TAG=$GIT_TAG | |
make build_image | |
make push_image |