Place the following in /.github/workflows/main.yml
on: push
name: Clean FTP directory
jobs:
clean:
runs-on: ubuntu-latest
steps:
- name:
uses: taylorgibb/ftp-clean@v2.0.3
with:
host: ${{secrets.FTP_HOST}}
user: "${{secrets.FTP_HOST}}|${{secrets.FTP_USER}}"
password: ${{secrets.FTP_PASSWORD}}- Some FTP severs have have virtual hosts enabled, remember to format your username correctly in these cases.
- Select the repository you want to add the action to
- Select the
Actionstab - Select
Blank workflow fileorSet up a workflow yourself, if you don't see these options manually create a yaml fileYour_Project/.github/workflows/main.yml - Paste the example above into your yaml file and save
- Now you need to add a key to the
secretssection in your project. To add asecretgo to theSettingstab in your project then selectSecrets. Add a newSecretfor:- FTP_HOST
- FTP_USER
- FTP_PASSWORD
- Update your yaml file settings
- If you appreciate this github action give it a ⭐
| Key | Required | Example | Default | Description |
|---|---|---|---|---|
| host | true | ftp.developerhut.co.za | FTP server address | |
| user | true | user | FTP server username | |
| password | true | password | FTP server password | |
| exclude | false | '["user_uploads"]' | '[""]' | JSON array of files and directories to exclude. |
on: push
name: Clean FTP directory
jobs:
clean:
runs-on: ubuntu-latest
steps:
- name:
uses: taylorgibb/ftp-clean@v2.0.3
with:
host: ${{secrets.FTP_HOST}}
user: "${{secrets.FTP_HOST}}|${{secrets.FTP_USER}}"
password: ${{secrets.FTP_PASSWORD}}
exclude: '["user_uploads"]'Want another example? Let me know by creating a github issue