Skip to content

Commit cf7969d

Browse files
committed
Push image and helm chart to ghcr
Provide public version of the latest operator build and helm chart
1 parent 529d007 commit cf7969d

File tree

4 files changed

+105
-1
lines changed

4 files changed

+105
-1
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
################################################################################
2+
# This file is AUTOGENERATED with <https://github.com/sapcc/go-makefile-maker> #
3+
# Edit Makefile.maker.yaml instead. #
4+
################################################################################
5+
6+
# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company
7+
# SPDX-License-Identifier: Apache-2.0
8+
9+
name: Container Registry GHCR
10+
"on":
11+
push:
12+
branches:
13+
- main
14+
workflow_dispatch: {}
15+
permissions:
16+
contents: read
17+
packages: write
18+
jobs:
19+
build-and-push-image:
20+
name: Push container to ghcr.io
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Check out code
24+
uses: actions/checkout@v5
25+
- name: Log in to the Container registry
26+
uses: docker/login-action@v3
27+
with:
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
registry: ghcr.io
30+
username: ${{ github.actor }}
31+
- name: Extract metadata (tags, labels) for Docker
32+
id: meta
33+
uses: docker/metadata-action@v5
34+
with:
35+
images: ghcr.io/${{ github.repository }}
36+
tags: |
37+
# https://github.com/docker/metadata-action#typeedge
38+
type=edge
39+
# https://github.com/docker/metadata-action#latest-tag
40+
type=raw,value=latest,enable={{is_default_branch}}
41+
# https://github.com/docker/metadata-action#typesemver
42+
type=semver,pattern={{raw}}
43+
type=semver,pattern=v{{major}}.{{minor}}
44+
type=semver,pattern=v{{major}}
45+
- name: Set up QEMU
46+
uses: docker/setup-qemu-action@v3
47+
- name: Set up Docker Buildx
48+
uses: docker/setup-buildx-action@v3
49+
- name: Build and push Docker image
50+
uses: docker/build-push-action@v6
51+
with:
52+
context: .
53+
labels: ${{ steps.meta.outputs.labels }}
54+
platforms: linux/amd64
55+
push: true
56+
tags: ${{ steps.meta.outputs.tags }}

.github/workflows/publish-helm.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: Publish Helm Chart GHCR
5+
"on":
6+
push:
7+
tags:
8+
- '*'
9+
paths:
10+
- 'charts/**'
11+
workflow_dispatch: {}
12+
13+
14+
jobs:
15+
publish-chart:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write # Required to push to GHCR
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v5
24+
25+
- name: Install Helm
26+
uses: azure/setup-helm@v1
27+
with:
28+
version: 'latest'
29+
30+
- name: Package Helm chart
31+
run: |
32+
helm package ./charts/openstack-hypervisor-operator
33+
34+
- name: Log in to GHCR
35+
run: |
36+
echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io --username ${{ github.actor }} --password-stdin
37+
38+
- name: Push Helm chart to GHCR
39+
run: |
40+
CHART_NAME=openstack-hypervisor-operator
41+
CHART_VERSION=$(grep "version:" ./charts/${CHART_NAME}/Chart.yaml | awk '{print $2}')
42+
helm push "${CHART_NAME}-${CHART_VERSION}.tgz" "oci://ghcr.io/${{ github.repository_owner }}/${CHART_NAME}"

Makefile.maker.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ githubWorkflow:
3333
securityChecks:
3434
enabled: true
3535
queries: security-extended
36+
pushContainerToGhcr:
37+
enabled: true
38+
tagStrategy:
39+
- edge
40+
- latest
41+
- semver
3642

3743
metadata:
3844
url: https://github.com/cobaltcore-dev/openstack-hypervisor-operator

config/manager/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33
images:
44
- name: controller
5-
newName: keppel.eu-de-1.cloud.sap/ccloud/openstack-hypervisor-operator
5+
newName: ghcr.io/cobaltcore-dev/openstack-hypervisor-operator
66
newTag: latest
77
resources:
88
- manager.yaml

0 commit comments

Comments
 (0)