Merge pull request #1510 from omerap12/fixed-wrong-labels #704
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 | |
permissions: | |
contents: read | |
security-events: write | |
jobs: | |
build: | |
# this is to prevent the job to run at forked projects | |
if: github.repository == 'kubernetes-sigs/aws-efs-csi-driver' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: crazy-max/ghaction-docker-buildx@v3 | |
with: | |
buildx-version: latest | |
qemu-version: latest | |
- name: Push to Dockerhub registry | |
run: | | |
BRANCH=$(echo $GITHUB_REF | cut -d'/' -f3) | |
SHORT_SHA=$(echo $GITHUB_SHA | cut -c -7) | |
REPO=amazon/aws-efs-csi-driver | |
if [ "$BRANCH" = "master" ]; then | |
TAG=$SHORT_SHA | |
else | |
TAG=$BRANCH | |
fi | |
docker login -u ${{ secrets.DOCKERHUB_USER }} -p ${{ secrets.DOCKERHUB_TOKEN }} | |
docker buildx build \ | |
-t $REPO:$TAG \ | |
--platform=linux/amd64,linux/arm64 \ | |
--progress plain \ | |
--push . | |
if [ "$BRANCH" = "master" ]; then | |
docker buildx build \ | |
-t $REPO:master \ | |
--platform=linux/amd64,linux/arm64 \ | |
--progress plain \ | |
--push . | |
fi |