Skip to content

Commit 46e056b

Browse files
committed
add the workflow step for helm release
1 parent d9aaffc commit 46e056b

File tree

2 files changed

+42
-142
lines changed

2 files changed

+42
-142
lines changed

.github/workflows/helm-release.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
paths:
77
- 'aws-integration-setup/charts/**'
88
- '.github/workflows/helm-release.yml'
9+
tags:
10+
- 'v*'
911
workflow_dispatch:
1012

1113
permissions:
@@ -36,6 +38,46 @@ jobs:
3638
with:
3739
version: v3.14.0
3840

41+
- name: Determine version
42+
id: version
43+
run: |
44+
if [[ $GITHUB_REF == refs/tags/* ]]; then
45+
# Use tag version (remove 'v' prefix)
46+
VERSION=${GITHUB_REF#refs/tags/v}
47+
echo "version=$VERSION" >> $GITHUB_OUTPUT
48+
echo "Using tag version: $VERSION"
49+
else
50+
# Auto-increment patch version for main branch commits
51+
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
52+
LATEST_VERSION=${LATEST_TAG#v}
53+
54+
# Parse semantic version
55+
IFS='.' read -ra VERSION_PARTS <<< "$LATEST_VERSION"
56+
MAJOR=${VERSION_PARTS[0]:-0}
57+
MINOR=${VERSION_PARTS[1]:-0}
58+
PATCH=${VERSION_PARTS[2]:-0}
59+
60+
# Increment patch version
61+
NEW_PATCH=$((PATCH + 1))
62+
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
63+
64+
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
65+
echo "Auto-incremented version: $LATEST_VERSION -> $NEW_VERSION"
66+
fi
67+
68+
- name: Update Chart version
69+
run: |
70+
VERSION="${{ steps.version.outputs.version }}"
71+
72+
# Update Chart.yaml with new version
73+
sed -i "s/^version:.*/version: $VERSION/" aws-integration-setup/charts/nullify-k8s-collector/Chart.yaml
74+
75+
# Optionally update appVersion to match
76+
sed -i "s/^appVersion:.*/appVersion: \"$VERSION\"/" aws-integration-setup/charts/nullify-k8s-collector/Chart.yaml
77+
78+
echo "Updated Chart.yaml to version $VERSION"
79+
cat aws-integration-setup/charts/nullify-k8s-collector/Chart.yaml | grep -E "^(version|appVersion):"
80+
3981
- name: Add Helm repos (if chart has dependencies)
4082
run: |
4183
helm repo add bitnami https://charts.bitnami.com/bitnami || true

.github/workflows/pr-validation.yml

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

0 commit comments

Comments
 (0)