Skip to content

Commit

Permalink
update renovate
Browse files Browse the repository at this point in the history
  • Loading branch information
coutug committed Mar 26, 2024
1 parent 707f713 commit 770fa14
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
11 changes: 10 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"allowPostUpgradeCommandTemplating": true,
"allowedPostUpgradeCommands": ["^.*"],
"extends": [
"config:recommended"
],
Expand All @@ -24,7 +26,14 @@
{
"matchDatasources": ["docker"],
"matchPackageNames": ["ghcr.io/coutug/mini-app"],
"registryUrls": ["ghcr.io"]
"registryUrls": ["ghcr.io"],
"postUpgradeTasks": {
"commands": [
"bash scripts/bump-chart-version.sh '{{{parentDir}}}' '{{{isMajor}}}' '{{{isMinor}}}' '{{{isPatch}}}'"
],
"fileFilters": ["**/Chart.yaml"],
"executionMode": "branch"
}
},
{
"matchManagers": ["flux"],
Expand Down
39 changes: 39 additions & 0 deletions scripts/bump-chart-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash

set -euo pipefail

parent_dir="$1"
is_major="$2"
is_minor="$3"
is_patch="$4"

version=$(grep "^version:" "charts/${parent_dir}/Chart.yaml" | awk '{print $2}')
if [[ ! $version ]]; then
echo "No valid version was found"
exit 1
fi

major=$(echo "$version" | cut -d. -f1)
minor=$(echo "$version" | cut -d. -f2)
patch=$(echo "$version" | cut -d. -f3)

# Bump major version
if [[ "$is_major" = 'true' ]]; then
major=$(( major + 1 ))
minor=0
patch=0
fi

# Bump minor version
if [[ "$is_minor" = 'true' ]]; then
minor=$(( minor + 1 ))
patch=0
fi

# Bump patch version
if [[ "$is_patch" = 'true' ]]; then
patch=$(( patch + 1 ))
fi

echo "Bumping version for $parent_dir from $version to $major.$minor.$patch"
sed -i "s/^version:.*/version: ${major}.${minor}.${patch}/g" "charts/${parent_dir}/Chart.yaml"

0 comments on commit 770fa14

Please sign in to comment.