https://github.com/Dinsen/FTPPublishDeploy
A deployment method for Publish to upload files using FTP
https://github.com/Dinsen/FTPPublishDeploy
deploy ftp publish publish-plugin
Last synced: 5 months ago
JSON representation
A deployment method for Publish to upload files using FTP
- Host: GitHub
- URL: https://github.com/Dinsen/FTPPublishDeploy
- Owner: dinsen
- License: mit
- Created: 2020-02-15T10:07:19.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-04-19T11:57:22.000Z (about 2 years ago)
- Last Synced: 2024-08-02T07:02:06.216Z (9 months ago)
- Topics: deploy, ftp, publish, publish-plugin
- Language: Swift
- Size: 13.7 KB
- Stars: 6
- Watchers: 1
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-publish - FTP
README
# FTPPublishDeploy

![]()

![]()
![]()
A deployment method for [Publish](https://github.com/johnsundell/publish) to upload files using FTP.
## Installation
Add FTPPublishDeploy to your `Package.swift` file.
```swift
let package = Package(
...
dependencies: [
.package(url: "https://github.com/dinsen/ftppublishdeploy", from: "0.1.0")
],
targets: [
.target(
...
dependencies: [
...
"FTPPublishDeploy"
]
)
]
...
)
```## Usage
There is 3 ways to declare your connection information.
1. Declare it directly into the `FTPConnection` struct:
```swift
let ftpConnection = FTPConnection(username: "batman",
password: "robin",
host: "my.host.com",
port: 21)
```
2. Create a JSON file called `ftp.json` in the root of your project:
```json
{
"username": "batman",
"password": "robin",
"host": "my.host.com",
"port": 21
}
```
*Remember to add the file to .gitignore to prevent your connection information being exposed!*Then use Files to locate the file:
```swift
import Files
...
let file = try File(path: #file)
guard let ftpConnection = try FTPConnection(file: file) else {
throw FilesError(path: file.path, reason: LocationErrorReason.missing)
}
```
3. Use environment declared in your CI service like [Bitrise](https://www.bitrise.io)
```swift
let environment = ProcessInfo.processInfo.environment
guard let ftpConnection = try FTPConnection(environment: environment) else {
return
}
```Last you can then declare your deployment method in your pipeline:
```swift
import FTPPublishDeploy
...
try Website().publish(using: [
...
.deploy(using: .ftp(connection: ftpConnection, sourcePath: "public_html/brian"))
])
```## Acknowledgement
Thanks to John Sundell (@johnsundell) for creating [Publish](https://github.com/johnsundell/publish)
## License
MIT License