From 9d1ed95d9aef94406bc25ccd93f562b840f4e92a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Pe=C4=8Dovnik?= Date: Thu, 1 Jul 2021 16:23:39 +0200 Subject: [PATCH] Add cache rootfs creation cleanup for old files to Github Actions (#2947) --- .github/workflows/build.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 728bf9f67c..62d51fabd8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -121,7 +121,7 @@ jobs: gpg-private-key: ${{ secrets.GPG_KEY1 }} passphrase: ${{ secrets.GPG_PASSPHRASE1 }} - - name: Sign commit and push changes + - name: Cleanup and sign rootfs cache if: ${{ success() }} env: @@ -131,6 +131,13 @@ jobs: sudo apt-get -y -qq install parallel cd build/cache/rootfs sudo chown -R $USER:$USER . + # cleanup + for line in $(ls | cut -d. -f1-4 | sort -u); do + if [[ ! -f $line ]]; then + [[ -n "$line" ]] && rm -f "$line"* + fi + done + # sign (for file in $(ls | cut -d. -f1-4 | sort -u); do if [ $(ls $file* | wc -l) -lt 3 ]; then echo "$file"