Files

56 lines
1.7 KiB
YAML

name: 'Tiles Cleanup'
on:
workflow_dispatch:
schedule:
# Every day at midnight
- cron: '0 0 * * *'
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
cleanup_tiles:
name: Cleanup Tiles & Styles
defaults:
run:
working-directory: 'deployment'
runs-on: ubuntu-latest
outputs:
KEY: ${{ steps.latest_build.outputs.KEY }}
env:
RCLONE_CONFIG: ${{ github.workspace }}/rclone.conf
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- id: token
uses: immich-app/devtools/actions/create-workflow-token@df46d635b905e618b88fc4c95baa920aeb30b309 # create-workflow-token-action-v3.0.1
with:
client-id: ${{ secrets.PUSH_O_MATIC_APP_CLIENT_ID }}
private-key: ${{ secrets.PUSH_O_MATIC_APP_KEY }}
permission-contents: read
- name: Setup Mise
uses: immich-app/devtools/actions/use-mise@06a9ef925332c91be647d6256642b86b398592c8 # use-mise-action-v3.2.1
with:
github_token: ${{ steps.token.outputs.token }}
- name: Configure Rclone
env:
ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_TILES_R2_KV_TOKEN_ID }}
SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_TILES_R2_KV_TOKEN_HASHED_VALUE }}
run: |
cat > "$RCLONE_CONFIG" <<EOF
[r2]
type = s3
provider = Cloudflare
region = auto
endpoint = https://601adaaa1eab190cdfe2945f9a6c89d0.r2.cloudflarestorage.com
access_key_id = $ACCESS_KEY_ID
secret_access_key = $SECRET_ACCESS_KEY
EOF
- name: Cleanup all non-latest tiles
run: ./scripts/r2-cleanup.sh