├── Dockerfile ├── LICENSE ├── README.md ├── action.yml └── entrypoint.sh /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.11 2 | 3 | COPY LICENSE README.md / 4 | 5 | RUN apk add --no-cache bash curl git 6 | 7 | RUN curl https://raw.githubusercontent.com/git-ftp/git-ftp/1.6.0/git-ftp > /bin/git-ftp 8 | 9 | RUN chmod 755 /bin/git-ftp 10 | 11 | COPY entrypoint.sh /entrypoint.sh 12 | 13 | ENTRYPOINT ["/entrypoint.sh"] 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Sebastian Popp 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # git-ftp-action 2 | 3 | Uses [git-ftp](https://github.com/git-ftp/git-ftp) and [GitHub actions](https://github.com/features/actions) to deploy a GitHub repository to a FTP server. 4 | 5 | **⚠️ Attention:** Make sure to use `actions/checkout` with `fetch-depth: 0`, since git-ftp needs the whole history in order to work. 6 | 7 | ## Example usage 8 | 9 | ``` 10 | name: Deploy via git-ftp 11 | on: push 12 | jobs: 13 | deploy: 14 | name: Deploy 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v3 18 | with: 19 | fetch-depth: 0 20 | - name: git-ftp push 21 | uses: sebastianpopp/git-ftp-action@releases/v3 22 | with: 23 | url: "ftp://ftp.example.com/path/" 24 | user: ${{ secrets.FTP_USER }} 25 | password: ${{ secrets.FTP_PWD }} 26 | ``` 27 | 28 | ## Input parameters 29 | 30 | Input parameter | Description | Required | Default 31 | --- | --- | --- | --- 32 | url | git-ftp url (see [documentation](https://github.com/git-ftp/git-ftp/blob/1.6.0/man/git-ftp.1.md#url)) | Yes | N/A 33 | user | FTP username | Yes | N/A 34 | password | FTP password | Yes | N/A 35 | syncroot | Specifies a local directory to sync from as if it were the git project root path. | No | `.` 36 | options | Additional options (see [documentation](https://github.com/git-ftp/git-ftp/blob/1.6.0/man/git-ftp.1.md#options)) | No | `--auto-init` 37 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'git-ftp-action' 2 | author: 'Sebastian Popp ' 3 | description: 'Uses git-ftp and GitHub actions to deploy a GitHub repository to a FTP server.' 4 | inputs: 5 | url: 6 | description: 'URL' 7 | required: true 8 | user: 9 | description: 'FTP login name' 10 | required: true 11 | password: 12 | description: 'FTP password' 13 | required: true 14 | syncroot: 15 | description: 'Specifies a local directory to sync from as if it were the git project root path.' 16 | required: false 17 | default: '.' 18 | options: 19 | description: 'Additional options' 20 | required: false 21 | default: '--auto-init' 22 | runs: 23 | using: 'docker' 24 | image: 'Dockerfile' 25 | branding: 26 | color: 'blue' 27 | icon: 'upload-cloud' 28 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -l 2 | 3 | git-ftp push \ 4 | --syncroot $INPUT_SYNCROOT \ 5 | --user $INPUT_USER \ 6 | --passwd $INPUT_PASSWORD \ 7 | $INPUT_OPTIONS \ 8 | $INPUT_URL 9 | --------------------------------------------------------------------------------