diff --git a/.github/workflows/container-registry-ghcr.yaml b/.github/workflows/container-registry-ghcr.yaml new file mode 100644 index 0000000..4dad327 --- /dev/null +++ b/.github/workflows/container-registry-ghcr.yaml @@ -0,0 +1,56 @@ +################################################################################ +# This file is AUTOGENERATED with # +# Edit Makefile.maker.yaml instead. # +################################################################################ + +# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company +# SPDX-License-Identifier: Apache-2.0 + +name: Container Registry GHCR +"on": + push: + branches: + - main + workflow_dispatch: {} +permissions: + contents: read + packages: write +jobs: + build-and-push-image: + name: Push container to ghcr.io + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v5 + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + password: ${{ secrets.GITHUB_TOKEN }} + registry: ghcr.io + username: ${{ github.actor }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }} + tags: | + # https://github.com/docker/metadata-action#typeedge + type=edge + # https://github.com/docker/metadata-action#latest-tag + type=raw,value=latest,enable={{is_default_branch}} + # https://github.com/docker/metadata-action#typesemver + type=semver,pattern={{raw}} + type=semver,pattern=v{{major}}.{{minor}} + type=semver,pattern=v{{major}} + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64 + push: true + tags: ${{ steps.meta.outputs.tags }} diff --git a/.github/workflows/publish-helm.yml b/.github/workflows/publish-helm.yml new file mode 100644 index 0000000..66a69ec --- /dev/null +++ b/.github/workflows/publish-helm.yml @@ -0,0 +1,42 @@ +# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company +# SPDX-License-Identifier: Apache-2.0 + +name: Publish Helm Chart GHCR +"on": + push: + branches: + - main + paths: + - 'charts/**' + workflow_dispatch: {} + + +jobs: + publish-chart: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write # Required to push to GHCR + + steps: + - name: Checkout repository + uses: actions/checkout@v5 + + - name: Install Helm + uses: azure/setup-helm@v1 + with: + version: 'latest' + + - name: Package Helm chart + run: | + helm package ./charts/openstack-hypervisor-operator + + - name: Log in to GHCR + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io --username ${{ github.actor }} --password-stdin + + - name: Push Helm chart to GHCR + run: | + CHART_NAME=openstack-hypervisor-operator + CHART_VERSION=$(grep "version:" ./charts/${CHART_NAME}/Chart.yaml | awk '{print $2}') + helm push "${CHART_NAME}-${CHART_VERSION}.tgz" "oci://ghcr.io/${{ github.repository_owner }}/${CHART_NAME}" diff --git a/Makefile.maker.yaml b/Makefile.maker.yaml index cc8b019..64e2181 100644 --- a/Makefile.maker.yaml +++ b/Makefile.maker.yaml @@ -33,6 +33,12 @@ githubWorkflow: securityChecks: enabled: true queries: security-extended + pushContainerToGhcr: + enabled: true + tagStrategy: + - edge + - latest + - semver metadata: url: https://github.com/cobaltcore-dev/openstack-hypervisor-operator diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 8c6d2d7..09f23cf 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -2,7 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization images: - name: controller - newName: keppel.eu-de-1.cloud.sap/ccloud/openstack-hypervisor-operator + newName: ghcr.io/cobaltcore-dev/openstack-hypervisor-operator newTag: latest resources: - manager.yaml