Skip to content

Commit 9813dcb

Browse files
committed
new helm oci step
1 parent b37c8c8 commit 9813dcb

File tree

4 files changed

+70
-49
lines changed

4 files changed

+70
-49
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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: Helm OCI Package GHCR
10+
"on":
11+
push:
12+
branches:
13+
- main
14+
tags:
15+
- '*'
16+
workflow_dispatch: {}
17+
permissions:
18+
contents: read
19+
packages: write
20+
jobs:
21+
build-and-push-helm-package:
22+
name: Build and publish Helm Chart OCI
23+
runs-on: large_runner_16core_64gb
24+
steps:
25+
- name: Check out code
26+
uses: actions/checkout@v6
27+
with:
28+
fetch-depth: 0
29+
fetch-tags: true
30+
- name: Install Helm
31+
uses: azure/setup-helm@v4.3.1
32+
- name: Lint Helm Chart
33+
run: helm lint charts/openstack-hypervisor-operator
34+
- name: Package Helm Chart
35+
run: |
36+
# try to detect a version from the git tags, only if the tag is exactly on the commit
37+
APP_VERSION=$(git describe --tags --exact-match ${{ github.sha }} 2>/dev/null || echo "")
38+
if [ -n "$APP_VERSION" ]; then
39+
VERSION=$(echo -n "$APP_VERSION" | sed -E 's/^v//')
40+
fi
41+
42+
# use the git sha as app-version, if no version could be detected from the tags
43+
if [ -z "$APP_VERSION" ]; then
44+
APP_VERSION=$(echo -n "sha-${{ github.sha }}")
45+
fi
46+
# use the git sha as helm version suffix, version is semver
47+
if [ -z "$VERSION" ] && [ -n "$APP_VERSION" ]; then
48+
VERSION="$(helm show chart charts/openstack-hypervisor-operator | grep -E "^version:" | awk '{print $2}' )+${APP_VERSION:0:11}"
49+
fi
50+
51+
HELM_ARGS=--dependency-update
52+
if [ -n "$APP_VERSION" ]; then
53+
HELM_ARGS="$HELM_ARGS --app-version $APP_VERSION"
54+
fi
55+
if [ -n "$VERSION" ]; then
56+
HELM_ARGS="$HELM_ARGS --version $VERSION"
57+
fi
58+
echo "Running helm package with $HELM_ARGS"
59+
helm package charts/openstack-hypervisor-operator --destination ./chart $HELM_ARGS
60+
- name: Log in to the Container registry
61+
uses: docker/login-action@v4
62+
with:
63+
password: ${{ secrets.GITHUB_TOKEN }}
64+
registry: ghcr.io
65+
username: ${{ github.actor }}
66+
- name: Push Helm Chart to ghcr.io
67+
run: helm push ./chart/*.tgz oci://ghcr.io/${{ github.repository_owner }}/charts

.github/workflows/publish-helm.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

Makefile.maker.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ githubWorkflow:
4242
- latest
4343
- semver
4444
- sha
45+
pushHelmChartToGhcr:
46+
path: charts/openstack-hypervisor-operator
4547
license:
4648
enabled: true
4749

config/manager/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: Kustomization
33
images:
44
- name: controller
55
newName: ghcr.io/cobaltcore-dev/openstack-hypervisor-operator
6-
newTag: latest
6+
newTag: ""
77
resources:
88
- manager.yaml
99
- secret.yaml

0 commit comments

Comments
 (0)