Remove old CRD stored versions when upgrading (#71) #167
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: k8ssandra-client build and deploy | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build_and_test: | |
name: Unit testing and linting | |
runs-on: ubuntu-latest | |
env: | |
CGO_ENABLED: 0 | |
steps: | |
- uses: actions/checkout@v4 | |
if: github.event_name == 'pull_request' | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: actions/checkout@v4 | |
if: github.event_name != 'pull_request' | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
cache: true | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: latest | |
# GHA requires longer timeout | |
args: --timeout=10m | |
# Optional: show only new issues if it's a pull request. The default value is `false`. | |
only-new-issues: ${{ github.event_name == 'pull_request' }} | |
skip-pkg-cache: true | |
skip-build-cache: true | |
- name: Unit Tests | |
run: | | |
make test | |
build_docker_image: | |
name: Build k8ssandra-client Docker Image | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
- name: Set git parsed values | |
id: vars | |
run: | | |
echo ::set-output name=sha_short::$(git rev-parse --short=8 ${{ github.sha }}) | |
echo ::set-output name=tag_name::${GITHUB_REF#refs/tags/} | |
mkdir -p build/ | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v6 | |
with: | |
load: false | |
file: cmd/kubectl-k8ssandra/Dockerfile | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: k8ssandra/k8ssandra-client:${{ steps.vars.outputs.sha_short }} | |
platforms: linux/amd64,linux/arm64 | |
context: . | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache |