-
Notifications
You must be signed in to change notification settings - Fork 344
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow forcing a specific chart version. (#479)
This is useful for patch releases on older release lines.
- Loading branch information
1 parent
79d0493
commit 7c33893
Showing
1 changed file
with
22 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
|
@@ -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 | ||
|
@@ -73,5 +83,7 @@ jobs: | |
|
||
- name: Run chart-releaser | ||
uses: helm/[email protected] | ||
with: | ||
mark_as_latest: "${{ github.event.inputs.mark_latest }}" | ||
env: | ||
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |