1 name: Cleanup stale artifacts
11 uses: actions/checkout@v4
15 - name: Remove stale artifacts from R2
17 AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
18 AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
19 AWS_ENDPOINT_URL: ${{ secrets.AWS_ENDPOINT_URL }}
22 if [[ -z $AWS_ACCESS_KEY_ID || -z $AWS_SECRET_ACCESS_KEY || -z $AWS_ENDPOINT_URL ]]; then
23 echo "Artifactory credentials are not defined. Most likely action is running from pull request. Not a bug."
27 echo "Generating artifact index"
28 aws s3 ls --endpoint-url $AWS_ENDPOINT_URL s3://expresslrs/ExpressLRS/ | grep PRE | awk '{print $2}' | sed s/\\/// > /tmp/artifacts
30 git branch --list --remotes --format '%(objectname)' > /tmp/hashes
31 git tag --list --format '%(objectname)' >> /tmp/hashes
33 for i in `grep -v -f /tmp/hashes /tmp/artifacts`; do
34 aws s3 rm --recursive --endpoint-url $AWS_ENDPOINT_URL s3://expresslrs/ExpressLRS/$i