TrueChartsClone/.github/workflows/renovate-bump.yaml

150 lines
6.3 KiB
YAML
Raw Normal View History

name: "Renovate: Bump on Push"
on:
push:
branches:
- "renovate/**"
tags-ignore:
- "**"
jobs:
renovate-bump:
name: Get changed Apps
runs-on: ubuntu-22.04
container:
image: ghcr.io/truecharts/devcontainer:3.1.10@sha256:c239addf725eb5cedf79517f8089fdafdc32b5270d1893ee87ae6e511b9bcae3
steps:
chore(deps): update github-actions (#12845) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/checkout](https://togithub.com/actions/checkout) | action | digest | `3df4ab1` -> `8ade135` | | [actions/checkout](https://togithub.com/actions/checkout) | action | minor | `v4.0.0` -> `v4.1.0` | --- ### ⚠ Dependency Lookup Warnings ⚠ Warnings were logged while processing this repo. Please check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>actions/checkout (actions/checkout)</summary> ### [`v4.1.0`](https://togithub.com/actions/checkout/blob/HEAD/CHANGELOG.md#v410) [Compare Source](https://togithub.com/actions/checkout/compare/v4.0.0...v4.1.0) - [Add support for partial checkout filters](https://togithub.com/actions/checkout/pull/1396) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://togithub.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMDMuMCIsInVwZGF0ZWRJblZlciI6IjM2LjEwMy4wIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIn0=-->
2023-09-22 19:20:52 +00:00
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
name: Checkout
with:
fetch-depth: 0
token: ${{ secrets.BOT_TOKEN }}
chore(deps): update github-actions (#12845) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/checkout](https://togithub.com/actions/checkout) | action | digest | `3df4ab1` -> `8ade135` | | [actions/checkout](https://togithub.com/actions/checkout) | action | minor | `v4.0.0` -> `v4.1.0` | --- ### ⚠ Dependency Lookup Warnings ⚠ Warnings were logged while processing this repo. Please check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>actions/checkout (actions/checkout)</summary> ### [`v4.1.0`](https://togithub.com/actions/checkout/blob/HEAD/CHANGELOG.md#v410) [Compare Source](https://togithub.com/actions/checkout/compare/v4.0.0...v4.1.0) - [Add support for partial checkout filters](https://togithub.com/actions/checkout/pull/1396) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://togithub.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMDMuMCIsInVwZGF0ZWRJblZlciI6IjM2LjEwMy4wIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIn0=-->
2023-09-22 19:20:52 +00:00
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
name: Checkout
with:
fetch-depth: 0
ref: master
path: master
- name: Setting repo parent dir as safe safe.directory
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: dorny/paths-filter@v2
id: filter
with:
list-files: json
filters: |
changed:
- 'charts/stable/**'
- 'charts/incubator/**'
- 'charts/SCALE/**'
- 'charts/library/**'
2021-11-08 13:55:20 +00:00
- 'charts/dependency/**'
- 'charts/core/**'
- 'charts/enterprise/**'
- 'charts/games/**'
- name: Filter filter-output
run: echo '${{ toJson(steps.filter.outputs) }}' > changes.json
- name: Bump and Sync
shell: bash
run: |
# Designed to ensure the appversion in Chart.yaml is in sync with the primary Chart tag if found
# Also makes sure that home link is pointing to the correct url
sync_tag() {
local chart="$1"
local chartname="$2"
local train="$3"
echo "Attempting to sync primary tag with appversion for: ${chartname}"
local tag="$(cat ${chart}/values.yaml | grep '^ tag: ' | awk -F" " '{ print $2 }' | head -1)"
tag="${tag%%@*}"
tag="${tag:-auto}"
tag=$(echo $tag | sed "s/release-//g")
tag=$(echo $tag | sed "s/release_//g")
tag=$(echo $tag | sed "s/version-//g")
tag=$(echo $tag | sed "s/version_//g")
tag="${tag#*V.}"
tag="${tag#*v-}"
tag="${tag#*v}"
tag="${tag%-*}"
tag="${tag:0:10}"
tag="${tag%-}"
tag="${tag%_}"
tag="${tag%.}"
echo "Updating tag of ${chartname} to ${tag}..."
sed -i -e "s|appVersion: .*|appVersion: \"${tag}\"|" "${chart}/Chart.yaml"
echo "Updating icon of ${chartname}..."
sed -i -e "s|icon: .*|icon: https:\/\/truecharts.org\/img\/hotlink-ok\/chart-icons\/${chartname}.png|" "${chart}/Chart.yaml"
echo "Updating home of ${chartname}..."
2022-12-19 22:13:08 +00:00
sed -i -e "s|home: .*|home: https:\/\/truecharts.org\/charts\/${train}\/${chartname}|" "${chart}/Chart.yaml"
echo "Attempting to update sources of ${chartname}..."
echo "Using go-yq verion: <$(go-yq -V)>"
# Get all sources (except truecharts)
curr_sources=$(go-yq '.sources[] | select(. != "https://github.com/truecharts*")' "${chart}/Chart.yaml")
# Empty sources list in-place
go-yq -i 'del(.sources.[])' "${chart}/Chart.yaml"
# Add truechart source
tcsource="https://github.com/truecharts/charts/tree/master/charts/$train/$chartname" go-yq -i '.sources += env(tcsource)' "${chart}/Chart.yaml"
# Add the rest of the sources
while IFS= read -r line; do
src="$line" go-yq -i '.sources += env(src)' "${chart}/Chart.yaml" || echo "src set error"
done <<< "$curr_sources"
echo "Sources of ${chartname} updated!"
}
export -f sync_tag
# The actual script
APPS=$(jq --raw-output '.changed_files | fromjson | .[] |= sub("(?<filepath>(?<first_directory>(?<root1>[\/]?)[^\/]+\/)(?<second_directory>(?<root2>[\/]?)[^\/]+\/)(?<third_directory>(?<root3>[\/]?)[^\/]+)(?<extra_paths>.+))"; "\(.third_directory)") | unique' changes.json | jq -r '.[]')
echo "changed apps: ${APPS[*]}"
for chart in ${APPS[*]}
do
if [[ "${chart}" == '.gitkeep' ]]; then
echo "Skipping..."
return
elif test -f "./charts/stable/${chart}/Chart.yaml"; then
train="stable"
elif test -f "./charts/incubator/${chart}/Chart.yaml"; then
train="incubator"
elif test -f "./charts/SCALE/${chart}/Chart.yaml"; then
train="SCALE"
elif test -f "./charts/library/${chart}/Chart.yaml"; then
train="library"
elif test -f "./charts/dependency/${chart}/Chart.yaml"; then
train="dependency"
elif test -f "./charts/core/${chart}/Chart.yaml"; then
train="core"
elif test -f "./charts/games/${chart}/Chart.yaml"; then
train="games"
elif test -f "./charts/enterprise/${chart}/Chart.yaml"; then
train="enterprise"
feat(metallb): add our own metallb operator (#9099) **Description** This adds our first chart for the `operators` train: metallb. It also includes some fixes to get said train to work. **⚙️ Type of change** - [x] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [x] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [x] 🔃 Refactor of current code **🧪 How Has This Been Tested?** <!-- Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration --> **📃 Notes:** This should not be used yet by end users. **✔️ Checklist:** - [x] ⚖️ My code follows the style guidelines of this project - [x] 👀 I have performed a self-review of my own code - [x] #️⃣ I have commented my code, particularly in hard-to-understand areas - [x] 📄 I have made corresponding changes to the documentation - [x] ⚠️ My changes generate no new warnings - [x] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [x] ⬆️ I increased versions for any altered app according to semantic versioning **➕ App addition** If this PR is an app addition please make sure you have done the following. - [x] 🪞 I have opened a PR on [truecharts/containers](https://github.com/truecharts/containers) adding the container to TrueCharts mirror repo. - [x] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._
2023-05-29 08:44:38 +00:00
elif test -f "./charts/operators/${chart}/Chart.yaml"; then
train="operators"
else
train="incubator"
fi
echo "Comparing versions for ${train}/${chart}"
master=$(cat ./master/charts/${train}/${chart}/Chart.yaml | grep "^version")
current=$(cat ./charts/${train}/${chart}/Chart.yaml | grep "^version")
echo "master version: ${master}"
echo "current version: ${current}"
if [[ "${master}" != "${current}" ]]; then
echo "Version does not have to be bumped"
else
echo "Bumping patch version for ${train}/${chart}"
./tools/bump.sh patch ./charts/${train}/${chart}
fi
sync_tag "charts/${train}/${chart}" "${chart}" "${train}"
done
- name: Cleanup
run: |
rm -rf changes.json
rm -rf master
- name: Commit and Push new version
run: |
git config user.name "TrueCharts-Bot"
git config user.email "bot@truecharts.org"
git add --all
git commit -sm "Commit bumped Chart Version" || exit 0
git push