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
Actions
tab - Select
Blank workflow file
orSet 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
secrets
section in your project. To add asecret
go to theSettings
tab in your project then selectSecrets
. Add a newSecret
for:- 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