0
0
mirror of https://github.com/sp-tarkov/build.git synced 2025-02-13 04:30:46 -05:00

Remove old nightly/bleeding release files (+1 month) from HTTPS source

This commit is contained in:
Refringe 2024-03-09 14:10:59 -05:00
parent 70ca5a09d7
commit cafabe0581
Signed by: Refringe
GPG Key ID: 7715B85B4A6306ED

View File

@ -335,6 +335,32 @@ jobs:
sshpass -p "${{ secrets.SFTP_PASSWORD }}" scp -v -o "Port=${{ secrets.SFTP_PORT }}" -o "ConnectTimeout=20" -o "UserKnownHostsFile=known_host" -o "StrictHostKeyChecking=yes" "/workspace/refringe/Build/${{ steps.generate-filename.outputs.filename }}" ${{ secrets.SFTP_USERNAME }}@${{ secrets.SFTP_HOST }}:/public sshpass -p "${{ secrets.SFTP_PASSWORD }}" scp -v -o "Port=${{ secrets.SFTP_PORT }}" -o "ConnectTimeout=20" -o "UserKnownHostsFile=known_host" -o "StrictHostKeyChecking=yes" "/workspace/refringe/Build/${{ steps.generate-filename.outputs.filename }}" ${{ secrets.SFTP_USERNAME }}@${{ secrets.SFTP_HOST }}:/public
shell: bash shell: bash
- name: Clean Old SFTP Releases
run: |
echo "${{ secrets.SFTP_HOST_KEY }}" > known_hosts
sshpass -p "${{ secrets.SFTP_PASSWORD }}" ssh -oPort=${{ secrets.SFTP_PORT }} -oConnectTimeout=20 -oUserKnownHostsFile=known_hosts -oStrictHostKeyChecking=yes ${{ secrets.SFTP_USERNAME }}@${{ secrets.SFTP_HOST }} << EOF
cd /public
# With a list of debug and bleeding edge builds...
ls | grep -E 'SPT-(DEBUG|BLEEDING).*\.7z$' | while read -r filename; do
# Extract date from filename
if [[ "\$filename" =~ ([0-9]{8})\.7z$ ]]; then
file_date="\${BASH_REMATCH[1]}"
file_date_fmt=\$(date -d "\${file_date:0:4}-\${file_date:4:2}-\${file_date:6:2}" +%s)
# Get current date minus 30 days
current_date=\$(date +%s)
limit_date=\$(date -d "@\$((current_date - 30 * 24 * 3600))" +%s)
# Compare dates and delete old files
if [[ "\$file_date_fmt" -lt "\$limit_date" ]]; then
echo "Deleting old file: \$filename"
rm "/public/\$filename"
fi
fi
done
EOF
shell: bash
- name: Upload Release to Mega - name: Upload Release to Mega
id: upload-mega id: upload-mega
run: | run: |