Skip to content

Commit

Permalink
feat: Introduce renovate (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkilchhofer committed May 22, 2024
1 parent cfc4290 commit 2e4ccb0
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .github/configs/renovate-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
platform: 'github',
gitAuthor: 'renovate[bot] <renovate[bot]@users.noreply.github.com>',
autodiscover: false,
allowPostUpgradeCommandTemplating: true,
allowedPostUpgradeCommands: [".*"],
};
16 changes: 16 additions & 0 deletions .github/renovate-bump-version.sh
Original file line number Diff line number Diff line change
@@ -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"
37 changes: 37 additions & 0 deletions .github/workflows/renovate.yaml
Original file line number Diff line number Diff line change
@@ -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 }}'
3 changes: 2 additions & 1 deletion charts/unifi/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
29 changes: 29 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -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=(?<datasource>.*?) depName=(?<depName>.*?)\\s+.+[vV]ersion: (?<currentValue>.*)"
]
}
],
"packageRules": [
{
"matchPackagePatterns": ["jacobalberty/unifi-docker"],
"postUpgradeTasks": {
"commands": ["./scripts/renovate-bump-version.sh unifi"]
}
},
{
"matchPackageNames": ["ghcr.io/renovatebot/renovate"],
"extends": ["schedule:monthly"]
}
]
}

0 comments on commit 2e4ccb0

Please sign in to comment.