Skip to content

Commit

Permalink
Merge pull request #138 from klutchell/kyle/renovate-post-upgrade
Browse files Browse the repository at this point in the history
Apply renovate postUpgradeTasks to bump balena.yml
  • Loading branch information
klutchell authored Apr 25, 2022
2 parents b1708ec + b1cc130 commit 7c032bf
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
23 changes: 23 additions & 0 deletions postUpgrade.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

set -e

depName="${1}"
newVersion="${2}"

if [ "${depName}" != "pihole/pihole" ]
then
echo "skipping dependency ${depName}!"
exit 0
fi

re='^0*([1-9][0-9]*)\.0*([1-9][0-9]*)\.0*([1-9][0-9]*)$'

if [[ "${newVersion}" =~ $re ]]
then
semver="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.${BASH_REMATCH[3]}"
sed "s/^version: .*$/version: ${semver}/" -i balena.yml
else
echo "${newVersion} is not a supported version string!"
exit 1
fi
7 changes: 6 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"extends": [
"config:base"
]
],
"postUpgradeTasks": {
"commands": ["./postUpgrade.sh {{{depName}}} {{{newVersion}}}"],
"fileFilters": ["balena.yml"],
"executionMode": "update"
}
}

0 comments on commit 7c032bf

Please sign in to comment.