-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(github): Use renovate to create PRs when upstream releases (#2358)
* feat(github): Use renovate to create PRs when upstream releases Signed-off-by: Tim Collins <tim@thecollins.team> * add write permissions Signed-off-by: Tim Collins <tim@thecollins.team> * remove the 'v' in the chart version Signed-off-by: Tim Collins <tim@thecollins.team> * switch to digests for actions Signed-off-by: Tim Collins <tim@thecollins.team> --------- Signed-off-by: Tim Collins <tim@thecollins.team>
- Loading branch information
Showing
2 changed files
with
144 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
## Used on Renovate PRs to bump the chart version and add a changelog entry | ||
## Reference: https://github.com/stefanzweifel/git-auto-commit-action | ||
## Reference: https://github.com/marketplace/actions/changed-files | ||
name: 'Chart Version Bump and Changelog' | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- labeled | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
helm-bumper: | ||
if: ${{ (contains(github.event.pull_request.labels.*.name, 'renovate')) }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
fetch-depth: 0 | ||
- name: Get changed files | ||
id: changed-files | ||
uses: tj-actions/changed-files@https://github.com/tj-actions/changed-files/commit/1c938490c880156b746568a518594309cfb3f66b # v40.2.1 | ||
with: | ||
files: charts/{argo-workflows,argo-cd,argo-events,argo-rollouts,argocd-image-updater}/Chart.yaml | ||
- name: "Bump Version and Changelog" | ||
run: | | ||
chartName="$(echo \"${{ steps.changed-files.outputs.all_changed_files }}\" | cut -d '/' -f2)" | ||
echo "Changed chart name is: $chartName" | ||
echo "----------------------------------------" | ||
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=$(expr $patch + 1) | ||
sed -i "s/^version:.*/version: ${major}.${minor}.${patch}/g" ${parentDir}/Chart.yaml | ||
# Add a changelog entry | ||
appVersion=$(grep '^appVersion:' ${parentDir}/Chart.yaml | awk '{print $2}') | ||
sed -i -e '/^ artifacthub.io\/changes: |/,$d' ${parentDir}/Chart.yaml | ||
echo " artifacthub.io/changes: |" >> ${parentDir}/Chart.yaml | ||
echo " - kind: changed" >> ${parentDir}/Chart.yaml | ||
echo " description: Bump ${chartName} to ${appVersion}" >> ${parentDir}/Chart.yaml | ||
cat ${parentDir}/Chart.yaml | ||
- name: "Commit and push changes" | ||
uses: stefanzweifel/git-auto-commit-action@8756aa072ef5b4a080af5dc8fef36c5d586e521d # v5.0.0 | ||
with: | ||
commit_options: '--signoff' |
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 |
---|---|---|
@@ -0,0 +1,91 @@ | ||
{ | ||
"$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
"kubernetes": { | ||
"fileMatch": ["\\.yaml$", "\\.yml$"] | ||
}, | ||
"extends": [ | ||
"config:base", | ||
"docker:enableMajor" | ||
], | ||
"labels": ["renovate"], | ||
"includePaths": [ | ||
"**/charts/argo-workflows/Chart.yaml", | ||
"**/charts/argo-cd/Chart.yaml", | ||
"**/charts/argo-events/Chart.yaml", | ||
"**/charts/argo-rollouts/Chart.yaml", | ||
"**/charts/argocd-image-updater/Chart.yaml" | ||
], | ||
"regexManagers": [ | ||
{ | ||
"fileMatch": ["charts/argo-workflows/Chart.yaml$"], | ||
"matchStrings": [ | ||
"\\sappVersion: (?<currentValue>.*)\\s" | ||
], | ||
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}", | ||
"depNameTemplate": "argoproj/argo-workflows", | ||
"datasourceTemplate": "github-releases" | ||
}, | ||
{ | ||
"fileMatch": ["charts/argo-cd/Chart.yaml$"], | ||
"matchStrings": [ | ||
"\\sappVersion: (?<currentValue>.*)\\s" | ||
], | ||
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}", | ||
"depNameTemplate": "argoproj/argo-cd", | ||
"datasourceTemplate": "github-releases" | ||
}, | ||
{ | ||
"fileMatch": ["charts/argo-events/Chart.yaml$"], | ||
"matchStrings": [ | ||
"\\sappVersion: (?<currentValue>.*)\\s" | ||
], | ||
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}", | ||
"depNameTemplate": "argoproj/argo-events", | ||
"datasourceTemplate": "github-releases" | ||
}, | ||
{ | ||
"fileMatch": ["charts/argo-rollouts/Chart.yaml$"], | ||
"matchStrings": [ | ||
"\\sappVersion: (?<currentValue>.*)\\s" | ||
], | ||
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}", | ||
"depNameTemplate": "argoproj/argo-rollouts", | ||
"datasourceTemplate": "github-releases" | ||
}, | ||
{ | ||
"fileMatch": ["charts/argocd-image-updater/Chart.yaml$"], | ||
"matchStrings": [ | ||
"\\sappVersion: (?<currentValue>.*)\\s" | ||
], | ||
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}", | ||
"depNameTemplate": "argoproj-labs/argocd-image-updater", | ||
"datasourceTemplate": "github-releases" | ||
} | ||
], | ||
"packageRules": [ | ||
{ | ||
"matchPackagePatterns": ["argoproj/argo-workflows"], | ||
"commitMessagePrefix": "chore(argo-workflows):" | ||
}, | ||
{ | ||
"matchPackagePatterns": ["argoproj/argo-cd"], | ||
"commitMessagePrefix": "chore(argo-cd):" | ||
}, | ||
{ | ||
"matchPackagePatterns": ["argoproj/argo-events"], | ||
"commitMessagePrefix": "chore(argo-events):" | ||
}, | ||
{ | ||
"matchPackagePatterns": ["argoproj/argo-rollouts"], | ||
"commitMessagePrefix": "chore(argo-rollouts):" | ||
}, | ||
{ | ||
"matchPackagePatterns": ["argoproj-labs/argocd-image-updater"], | ||
"commitMessagePrefix": "chore(argocd-image-updater):" | ||
}, | ||
{ | ||
"matchPackagePatterns": ["redis-ha"], | ||
"enabled": false | ||
} | ||
] | ||
} |