From 720bd42d60e640c18275abce83cec8eea25af8d8 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Mon, 5 Aug 2024 10:46:54 +0200 Subject: [PATCH] ci: github action to push image to quay Adding a github action to build and push docker image to quay Signed-off-by: Madhu Rajanna --- .github/workflows/push.yaml | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/push.yaml diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml new file mode 100644 index 00000000..6990d01d --- /dev/null +++ b/.github/workflows/push.yaml @@ -0,0 +1,44 @@ +name: push +on: + pull_request: + branches: + - main + - release-* + +jobs: + build-and-push: + runs-on: ubuntu-latest + if: github.repository == 'ceph/ceph-csi-operator' + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + #- name: Login to Quay.io + #uses: docker/login-action@v3 + #with: + # registry: quay.io + # username: ${{ secrets.QUAY_IO_USERNAME }} + # password: ${{ secrets.QUAY_IO_PASSWORD }} + - name: Set up Image tag + run: | + echo "image tag ${{ github.ref }}" + if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then + echo "IMAGE_TAG=latest" >> $GITHUB_ENV + elif [[ "${{ github.ref }}" == refs/heads/* ]]; then + TAG=$(echo ${{ github.ref }} | sed 's/refs\/heads\///') + echo "IMAGE_TAG=${TAG}" >> $GITHUB_ENV + elif [[ "${{ github.ref }}" == refs/tags/* ]]; then + TAG=$(echo ${{ github.ref }} | sed 's/refs\/tags\///') + echo "IMAGE_TAG=${TAG}" >> $GITHUB_ENV + fi + - name: print env + run: echo $IMAGE_TAG + + - name: Build and push Docker images + run: make docker-buildx IMAGE_TAG=${{ env.IMAGE_TAG }}