From 991a22ac25fcd239f1706b6b79a610c92ffe5257 Mon Sep 17 00:00:00 2001 From: Michael Burman Date: Fri, 1 Sep 2023 13:49:53 +0300 Subject: [PATCH] Add GHA release process to push images on tag --- .github/workflows/release.yaml | 55 ++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..2aaa50e --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,55 @@ +name: Cass Operator Release + +on: + push: + tags: + - 'v*.*.*' + workflow_dispatch: + # Allow to rerun this for a tag to get updated UBI-images + +jobs: + release_cass_operator: + name: Release Docker Image + runs-on: ubuntu-latest + steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v3 + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version-file: 'go.mod' + cache: true + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_PASSWORD }} + - name: Login to GitHub Container Registry + if: ${{ !env.ACT }} + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Set git parsed values + id: vars + shell: bash + run: | + echo "sha_short=$(git rev-parse --short=8 ${{ github.sha }})" >> $GITHUB_OUTPUT + echo "tag_name=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + echo "TARGET_VERSION=$(echo ${GITHUB_REF#refs/tags/} | awk '{print substr($0,2)}')" >> $GITHUB_ENV + - name: Build and push + id: docker_build + uses: docker/build-push-action@v3 + with: + load: false + file: cmd/kubectl-k8ssandra/Dockerfile + push: true + tags: k8ssandra/k8ssandra-client:${{ steps.vars.outputs.tag_name }}, ghcr.io/k8ssandra/k8ssandra-client:${{ steps.vars.outputs.tag_name }} + platforms: linux/amd64,linux/arm64 + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache