diff --git a/.github/configs/renovate-config.js b/.github/configs/renovate-config.js new file mode 100644 index 0000000..9118ffe --- /dev/null +++ b/.github/configs/renovate-config.js @@ -0,0 +1,7 @@ +module.exports = { + platform: 'github', + gitAuthor: 'renovate[bot] ', + autodiscover: false, + allowPostUpgradeCommandTemplating: true, + allowedPostUpgradeCommands: [".*"], + }; diff --git a/.github/renovate-bump-version.sh b/.github/renovate-bump-version.sh new file mode 100755 index 0000000..2536242 --- /dev/null +++ b/.github/renovate-bump-version.sh @@ -0,0 +1,16 @@ +#!/bin/bash +chartName="${1}" +if [ -z "${chartName}" ]; then + echo "Missing argument 'chartName'" >&2 + exit 1 +fi + +parentDir="charts/${chartName}" + +# Bump the chart version by one patch version +version=$(grep '^version:' "${parentDir}/Chart.yaml" | awk '{print $2}') +major=$(echo "${version}" | cut -d. -f1) +minor=$(echo "${version}" | cut -d. -f2) +patch=$(echo "${version}" | cut -d. -f3) +patch=$((patch + 1)) +sed -i "s/^version:.*/version: ${major}.${minor}.${patch}/g" "${parentDir}/Chart.yaml" diff --git a/.github/workflows/renovate.yaml b/.github/workflows/renovate.yaml new file mode 100644 index 0000000..ccb2b0a --- /dev/null +++ b/.github/workflows/renovate.yaml @@ -0,0 +1,37 @@ +name: Renovate +on: + # The "*" (#42, asterisk) character has special semantics in YAML, so this + # string has to be quoted. + schedule: + - cron: '0 * * * *' + # Manual trigger is also possible + workflow_dispatch: {} + +permissions: + contents: read + +jobs: + renovate: + if: github.repository == 'mkilchhofer/unifi-chart' + runs-on: ubuntu-latest + steps: + - name: Get token + uses: actions/create-github-app-token@a0de6af83968303c8c955486bf9739a57d23c7f1 # v1.10.0 + id: get_token + with: + app-id: ${{ vars.RENOVATE_APP_ID }} + private-key: ${{ secrets.RENOVATE_APP_PRIVATE_KEY }} + + - name: Checkout + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + + - name: Self-hosted Renovate + uses: renovatebot/github-action@063e0c946b9c1af35ef3450efc44114925d6e8e6 # v40.1.11 + with: + configurationFile: .github/configs/renovate-config.js + # renovate: datasource=docker depName=ghcr.io/renovatebot/renovate + renovate-version: 37.332.0 + token: '${{ steps.get_token.outputs.token }}' + env: + LOG_LEVEL: 'debug' + RENOVATE_REPOSITORIES: '${{ github.repository }}' diff --git a/charts/unifi/Chart.yaml b/charts/unifi/Chart.yaml index 10c451c..5aea8cb 100644 --- a/charts/unifi/Chart.yaml +++ b/charts/unifi/Chart.yaml @@ -1,9 +1,10 @@ apiVersion: v2 +# renovate: datasource=github-releases depName=jacobalberty/unifi-docker appVersion: v8.1.113 kubeVersion: ">=1.18-0" description: Ubiquiti Network's Unifi Controller name: unifi -version: 1.10.0 +version: 1.10.1 keywords: - ubiquiti - unifi diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..102b7f5 --- /dev/null +++ b/renovate.json @@ -0,0 +1,29 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:recommended", + "docker:enableMajor" + ], + "labels": ["renovate"], + "customManagers": [ + { + "customType": "regex", + "fileMatch": ["(^|\\/).*\\.ya?ml$"], + "matchStrings": [ + "# renovate: datasource=(?.*?) depName=(?.*?)\\s+.+[vV]ersion: (?.*)" + ] + } + ], + "packageRules": [ + { + "matchPackagePatterns": ["jacobalberty/unifi-docker"], + "postUpgradeTasks": { + "commands": ["./scripts/renovate-bump-version.sh unifi"] + } + }, + { + "matchPackageNames": ["ghcr.io/renovatebot/renovate"], + "extends": ["schedule:monthly"] + } + ] +}