Gflarity/allow kai (#219) #51
This file contains hidden or 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
| # /* | |
| # Copyright 2025 The Grove Authors. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| # */ | |
| name: Build and Publish Artifacts | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| tags: | |
| - '*.*.*' | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| DOCKER_REGISTRY: "ghcr.io/${{ github.repository_owner }}/grove" | |
| jobs: | |
| build-and-push: | |
| name: Build & Push | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| - name: Extract package version from tag | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| PACKAGE_VERSION=${GITHUB_REF_NAME} | |
| echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV | |
| echo $PACKAGE_VERSION | |
| - name: Extract package version from branch commit | |
| if: startsWith(github.ref, 'refs/heads/') | |
| run: | | |
| PACKAGE_VERSION=v0.0.0-$(git rev-parse --short HEAD) | |
| echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV | |
| echo $PACKAGE_VERSION | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.24.4' | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Docker build & push | |
| run: | | |
| make --directory=operator docker-build PLATFORM=linux/amd64,linux/arm64 VERSION=$PACKAGE_VERSION REGISTRY=$DOCKER_REGISTRY DOCKER_BUILD_ADDITIONAL_ARGS=--push | |
| - name: Copy CRDs to charts | |
| run: | | |
| ./operator/hack/prepare-charts.sh | |
| - name: Build Helm chart | |
| run: | | |
| sed -i "s#repository: grove-operator#repository: ghcr.io/nvidia/grove/grove-operator#" operator/charts/values.yaml | |
| sed -i "s#tag:.*#tag: $PACKAGE_VERSION#" operator/charts/values.yaml | |
| sed -i "s#value: grove-initc#value: ghcr.io/nvidia/grove/grove-initc#" operator/charts/values.yaml | |
| helm package ./operator/charts --app-version $PACKAGE_VERSION --version $PACKAGE_VERSION | |
| - name: Push Helm Chart | |
| run: | | |
| helm push ./grove-charts-$PACKAGE_VERSION.tgz oci://${{ env.DOCKER_REGISTRY }} |