TrueChartsCatalogClone/.github/workflows/prune.yaml

50 lines
1.5 KiB
YAML
Raw Normal View History

2021-08-31 09:10:53 +00:00
name: "Housekeeping"
on:
workflow_dispatch:
jobs:
2021-08-31 09:12:47 +00:00
Prune:
2021-08-31 09:10:53 +00:00
runs-on: ubuntu-latest
2021-08-31 09:12:47 +00:00
name: "Pruning"
2021-08-31 09:10:53 +00:00
steps:
- name: Checkout branch
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.BOT_TOKEN }}
2021-08-31 09:12:47 +00:00
- name: Prune App Versions
2021-08-31 09:10:53 +00:00
run: |
for train in stable incubator
do
for chart in ${train}/*; do
if [ -f "${chart}/item.yaml" ]; then
maxchartversion=$(ls ${chart} | grep -v item.yaml | sort -Vr | head -n1)
maxchartversion=${maxchartversion%/}
chartname=$(basename ${chart})
for version in ${chart}/*; do
versionname=$(basename ${version})
if [ -f "${version}/Chart.yaml" ]; then
if [[ "${versionname}" != "${maxchartversion}" ]]; then
echo "Removing older version ${versionname} for ${chartname}"
rm -Rf ${version}
else
echo "${versionname} is the latest version, skipping..."
fi
fi
done
else
echo "Invalid App"
fi
done
done
2021-08-31 09:12:47 +00:00
- name: Commit and Push Pruned catalog
2021-08-31 09:10:53 +00:00
run: |
git config user.name "TrueCharts-Bot"
git config user.email "bot@truecharts.org"
git add --all
git commit -sm "Daily Prune" || exit 0
git push