feat: SUSE AI Operator #4
Workflow file for this run
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
| name: Build and Publish SUSE AI Operator [Container and Helm Chart] | |
| on: [push, pull_request, workflow_dispatch] | |
| env: | |
| CONTAINER_REGISTRY: ghcr.io/suse/suse-ai-operator | |
| CHART_PATH: chart/suse-ai-operator | |
| CHART_REGISTRY: oci://ghcr.io/suse/chart | |
| jobs: | |
| container: | |
| if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'suse-ai-operator-') }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| actions: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Calculate tags | |
| id: tags | |
| shell: bash | |
| run: | | |
| echo "TAGS<<##" >> "$GITHUB_OUTPUT" | |
| ref=${{ github.ref }} | |
| case "$ref" in | |
| refs/heads/main) | |
| echo "latest" >> "$GITHUB_OUTPUT";; | |
| refs/tags/suse-ai-operator-*) | |
| echo "${ref#refs/tags/suse-ai-operator-}" >> "$GITHUB_OUTPUT";; | |
| *) | |
| echo "${{ github.sha }}" >> "$GITHUB_OUTPUT";; | |
| esac | |
| echo "##" >> "$GITHUB_OUTPUT" | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Setup Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Get Docker Metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.CONTAINER_REGISTRY }} | |
| tags: | | |
| type=raw,value=${{ steps.tags.outputs.TAGS }} | |
| type=raw,value=latest | |
| - name: Build Docker Container | |
| id: push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./suse-ai-operator | |
| labels: ${{ steps.meta.outputs.labels }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| push: true | |
| platforms: linux/arm64,linux/amd64 | |
| helm: | |
| needs: container | |
| if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'suse-ai-operator-') }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Package Helm Chart | |
| id: package | |
| run: | | |
| chart_package=$(helm package $CHART_PATH --destination . | awk '{print $NF}') | |
| echo "chart_package=$chart_package" >> $GITHUB_OUTPUT | |
| - name: Publish Helm Chart | |
| run: | | |
| helm push ${{ steps.package.outputs.chart_package }} \ | |
| $CHART_REGISTRY | |