Delete unused uploaded images #208
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Delete unused uploaded images | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
jobs: | |
cleanupimages: | |
name: Clean up orphan images that are no longer used | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
name: id_lzm | |
key: ${{ secrets.LZM_SSH_PRIVATE_KEY }} | |
known_hosts: ${{ secrets.LZM_SSH_KNOWN_HOSTS }} | |
config: | | |
Host monitoring.localzero.net monitoring-test.localzero.net lzm | |
HostName monitoring.localzero.net | |
User monitoring | |
IdentityFile ~/.ssh/id_lzm | |
- name: Run clean up images command | |
shell: bash | |
run: | | |
ssh -tt monitoring.localzero.net /bin/bash << EOF | |
set -e | |
docker exec djangoapp-production python manage.py cleanupimages | |
exit | |
EOF |