name: Upload data to files.jojojux.de

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - name: Change Link Origin
      run: find . -type f -exec sed -i 's/https:\/\/raw.githubusercontent.com\/J0J0HA\/custom-achievement-lists\/main/https:\/\/files.jojojux.de\/resources\/builds\/custom-achievement-lists/g' {} +
    - name: FTP Upload
      uses: wangyucode/sftp-upload-action@v2.0.2
      with:
        host: 212.227.8.25
        username: ${{ secrets.FTP_USERNAME }}
        password: ${{ secrets.FTP_PASSWORD }}
        localDir: ./
        remoteDir: /www/files.jojojux.de/resources/builds/custom-achievement-lists
