Skip to content

Commit

Permalink
Merge pull request #12957 from daschuer/download_cleanup
Browse files Browse the repository at this point in the history
Add CI runner that allows cleaning up the download server
  • Loading branch information
ronso0 authored Mar 15, 2024
2 parents 24b415c + c5767c1 commit 163ef86
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/download_cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Clean up downloads

on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-22.04

steps:
- name: "Set up SSH Agent"
if: github.event_name == 'push' && env.SSH_PRIVATE_KEY != null
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
SSH_PRIVATE_KEY: ${{ secrets.DOWNLOADS_HOSTGATOR_DOT_MIXXX_DOT_ORG_KEY }}
SSH_HOST: downloads-hostgator.mixxx.org
run: |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add - <<< "${SSH_PRIVATE_KEY}"
mkdir -p "${HOME}/.ssh"
ssh-keyscan "${SSH_HOST}" >> "${HOME}/.ssh/known_hosts"
echo "SSH_AUTH_SOCK=${SSH_AUTH_SOCK}" >> "${GITHUB_ENV}"
- name: Delete obsolete files
if: env.SSH_AUTH_SOCK != null
run: |
mkdir empty_folder
echo snapshots/build-checks-fix/* >> include_file.txt
echo snapshots/build-checks-fix >> include_file.txt
rsync --verbose --times --recursive --include-from=include_file.txt --exclude=* --delete "empty_folder/" "${SSH_USER}@${SSH_HOST}:${DESTDIR}/"
env:
DESTDIR: public_html/downloads
SSH_HOST: downloads-hostgator.mixxx.org
SSH_USER: mixxx

0 comments on commit 163ef86

Please sign in to comment.