Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions .github/workflows/publish-charts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ on:
options:
- minor
- patch
force_version:
description: "Force a chart version (ignore Chart bump level)"
mark_latest:
description: "Mark this release as the latest"
type: boolean
default: true

jobs:
release:
Expand Down Expand Up @@ -46,19 +52,23 @@ jobs:
run: |
RE='([0-9]+)\.([0-9]+)\.([0-9]+)'

current="$(grep -m 1 '^version:' Chart.yaml | awk '{print $2}')"
NEW_VERSION="${{ github.event.inputs.force_version }}"

MAJOR=`echo $current | sed -E "s#$RE#\1#"`
MINOR=`echo $current | sed -E "s#$RE#\2#"`
PATCH=`echo $current | sed -E "s#$RE#\3#"`
if [ -z "${NEW_VERSION}" ]; then
current="$(grep -m 1 '^version:' Chart.yaml | awk '{print $2}')"

if [ "${{ github.event.inputs.bump }}" == "minor" ]; then
MINOR=$((MINOR+1))
PATCH=0
else
PATCH=$((PATCH+1))
MAJOR=`echo $current | sed -E "s#$RE#\1#"`
MINOR=`echo $current | sed -E "s#$RE#\2#"`
PATCH=`echo $current | sed -E "s#$RE#\3#"`

if [ "${{ github.event.inputs.bump }}" == "minor" ]; then
MINOR=$((MINOR+1))
PATCH=0
else
PATCH=$((PATCH+1))
fi
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
fi
NEW_VERSION="$MAJOR.$MINOR.$PATCH"

sed -i -e "s/^version: .*/version: $NEW_VERSION/" Chart.yaml
sed -i -e "s/^appVersion: .*/appVersion: ${{ github.event.inputs.version }}/" Chart.yaml
Expand All @@ -73,5 +83,7 @@ jobs:

- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.6.0
with:
mark_as_latest: "${{ github.event.inputs.mark_latest }}"
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"