This repository has been archived on 2025-05-18. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
truecharts-catalog/.github/workflows/prune.yaml
kjeld Schouten-Lebbing 2bc590f6cd only run prune when manually triggered.
Versions now get pruned by the upload script
2021-09-12 10:11:01 +02:00

50 lines
1.5 KiB
YAML

name: "Housekeeping"
on:
workflow_dispatch:
jobs:
Prune:
runs-on: ubuntu-latest
name: "Pruning"
steps:
- name: Checkout branch
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.BOT_TOKEN }}
- name: Prune App Versions
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
- name: Commit and Push Pruned catalog
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