Skip to content

chore(deps): update Go dependencies (#216) #15

chore(deps): update Go dependencies (#216)

chore(deps): update Go dependencies (#216) #15

name: release
on:
push:
tags-ignore:
- 'kafka-*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# GitHub Container Registry
GHCR_REGISTRY: ghcr.io
# github.repository as <account>/<repo>
GHCR_IMAGE_NAME: ${{ github.repository }}
# Docker Hub image name
DOCKERHUB_IMAGE: adobe/kafka-operator
jobs:
prepare:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
tag: ${{ steps.vars.outputs.tag }}
built_at: ${{ steps.date.outputs.built_at }}
steps:
- name: Get tag name
id: vars
run: echo "tag=${GITHUB_REF:10}" >> $GITHUB_OUTPUT
- name: Set Release Date
id: date
run: |
echo "built_at=$(date --rfc-3339=date)" >> $GITHUB_OUTPUT
operator-test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up Go 1.25
uses: actions/setup-go@v6
with:
go-version: '1.25'
id: go
- name: Clean Go module cache for reproducible builds
run: |
# Clean any existing Go module cache for clean, reproducible builds
sudo rm -rf ~/go/pkg/mod || true
sudo rm -rf ~/.cache/go-build || true
- name: Set up Go for root
run: |
sudo ln -sf `which go` `sudo which go` || true
sudo go version
- name: get go version
run: go version
- name: Gofmt and License checks
run: make check
- name: unit tests
run: make test
build-operator:
runs-on: ubuntu-latest
needs: [prepare, operator-test]
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Log into GitHub Container Registry ${{ env.GHCR_REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.DOCKERHUB_IMAGE }}
${{ env.GHCR_REGISTRY }}/${{ env.GHCR_IMAGE_NAME }}
tags: |
type=ref,event=tag
labels: |
org.opencontainers.image.description=Kafka Operator for Kubernetes
- name: Build and push operator docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
build-args: |
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
BUILT_AT=${{ needs.prepare.outputs.built_at }}
GIT_SHA=${{ github.sha }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
push: ${{ startsWith(github.ref, 'refs/tags/') }}
release-helm:
runs-on: ubuntu-latest
needs: [prepare, build-operator]
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Update Chart.yaml version, values.yaml image tag, and README.md
run: |
sed -i "s/^version:.*/version: \"${{ needs.prepare.outputs.tag }}\"/" charts/kafka-operator/Chart.yaml
sed -i "s/^appVersion:.*/appVersion: \"${{ needs.prepare.outputs.tag }}\"/" charts/kafka-operator/Chart.yaml
# Ensure consistent space-based indentation and update tag
sed -i 's/\t/ /g' charts/kafka-operator/values.yaml
sed -i "/^operator:/,/^[^[:space:]]/ { /^[[:space:]]*image:/,/^[[:space:]]*[^[:space:]]/ s/^[[:space:]]*tag:.*/ tag: \"${{ needs.prepare.outputs.tag }}\"/; }" charts/kafka-operator/values.yaml
# Update README.md version references
sed -i "s/--version [0-9]\+\.[0-9]\+\.[0-9]\+-[a-zA-Z0-9-]\+/--version ${{ needs.prepare.outputs.tag }}/g" charts/kafka-operator/README.md
sed -i "s/\`[0-9]\+\.[0-9]\+\.[0-9]\+-[a-zA-Z0-9-]\+\`/\`${{ needs.prepare.outputs.tag }}\`/g" charts/kafka-operator/README.md
- name: Push Helm Chart to GHCR
uses: appany/[email protected]
with:
name: kafka-operator
repository: ${{ github.repository_owner }}/helm-charts
tag: ${{ needs.prepare.outputs.tag }}
path: charts/kafka-operator
registry: ${{ env.GHCR_REGISTRY }}
registry_username: ${{ github.actor }}
registry_password: ${{ secrets.GITHUB_TOKEN }}
update_dependencies: 'true'