mirror of
https://github.com/SamKirkland/FTP-Deploy-Action.git
synced 2025-08-15 06:25:05 +00:00
Compare commits
43 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
8e83cea867 | ||
|
c15ea8f529 | ||
|
8a24039354 | ||
|
89e533f02c | ||
|
cf1b406626 | ||
|
60edb12d91 | ||
|
28fb6c755c | ||
|
08c527ecdf | ||
|
cfcb39fa3c | ||
|
1d198bef28 | ||
|
b8e4443bb0 | ||
|
84f66893ce | ||
|
0734c4dc18 | ||
|
ec28745b59 | ||
|
1b21034a8d | ||
|
ed91728692 | ||
|
118eb423de | ||
|
e8964f3093 | ||
|
f458cc0704 | ||
|
01dea7c17f | ||
|
16956be3a6 | ||
|
4f0dc298db | ||
|
d0aa838726 | ||
|
f55279346a | ||
|
93a0898871 | ||
|
1d31526b7a | ||
|
d3fa328f10 | ||
|
d6ad227aa5 | ||
|
c7bb3d9877 | ||
|
a7da5e54d2 | ||
|
a9644610a0 | ||
|
825d1b8f3b | ||
|
ba86a1bf13 | ||
|
65c6a8f943 | ||
|
d2724c6194 | ||
|
59992de6c6 | ||
|
408fa95d1f | ||
|
223d805d5b | ||
|
3695ee6be8 | ||
|
ca38d85340 | ||
|
a7d2862205 | ||
|
1cffb780cf | ||
|
2d118d9190 |
5
.github/workflows/ftp.yml
vendored
5
.github/workflows/ftp.yml
vendored
@ -2,7 +2,7 @@ name: FTP Test
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ master ]
|
branches: [master]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
@ -10,7 +10,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: 🚚 Get latest code
|
- name: 🚚 Get latest code
|
||||||
uses: actions/checkout@v2.3.2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: 📂 Sync files
|
- name: 📂 Sync files
|
||||||
uses: ./
|
uses: ./
|
||||||
@ -18,4 +18,3 @@ jobs:
|
|||||||
server: ftp.samkirkland.com
|
server: ftp.samkirkland.com
|
||||||
username: test@samkirkland.com
|
username: test@samkirkland.com
|
||||||
password: ${{ secrets.ftp_password }}
|
password: ${{ secrets.ftp_password }}
|
||||||
|
|
||||||
|
5
.github/workflows/ftps.yml
vendored
5
.github/workflows/ftps.yml
vendored
@ -2,7 +2,7 @@ name: FTPS Test
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ master ]
|
branches: [master]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
@ -10,7 +10,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: 🚚 Get latest code
|
- name: 🚚 Get latest code
|
||||||
uses: actions/checkout@v2.3.2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: 📂 Sync files
|
- name: 📂 Sync files
|
||||||
uses: ./
|
uses: ./
|
||||||
@ -19,4 +19,3 @@ jobs:
|
|||||||
username: test@samkirkland.com
|
username: test@samkirkland.com
|
||||||
password: ${{ secrets.ftp_password }}
|
password: ${{ secrets.ftp_password }}
|
||||||
protocol: ftps
|
protocol: ftps
|
||||||
security: strict
|
|
||||||
|
98
README.md
98
README.md
@ -20,10 +20,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: 🚚 Get latest code
|
- name: 🚚 Get latest code
|
||||||
uses: actions/checkout@v2.3.2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: 📂 Sync files
|
- name: 📂 Sync files
|
||||||
uses: SamKirkland/FTP-Deploy-Action@4.0.0
|
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
|
||||||
with:
|
with:
|
||||||
server: ftp.samkirkland.com
|
server: ftp.samkirkland.com
|
||||||
username: myFtpUserName
|
username: myFtpUserName
|
||||||
@ -33,7 +33,7 @@ jobs:
|
|||||||
---
|
---
|
||||||
|
|
||||||
### Requirements
|
### Requirements
|
||||||
- You must have ftp access to your server. If your host requires ssh please use my web-deploy action (coming soon)
|
- You must have ftp access to your server. If your host allows or requires ssh please use my [web-deploy](https://github.com/SamKirkland/web-deploy) action
|
||||||
- Some web hosts change the default port (21), check with your host for your port number
|
- Some web hosts change the default port (21), check with your host for your port number
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -55,21 +55,22 @@ Keys can be added directly to your .yml config file or referenced from your proj
|
|||||||
To add a `secret` go to the `Settings` tab in your project then select `Secrets`.
|
To add a `secret` go to the `Settings` tab in your project then select `Secrets`.
|
||||||
I strongly recommend you store your `password` as a secret.
|
I strongly recommend you store your `password` as a secret.
|
||||||
|
|
||||||
| Key Name | Required | Example | Default Value | Description |
|
| Key Name | Required | Example | Default Value | Description |
|
||||||
|-------------------------|----------|----------------------------|---------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|-------------------------|----------|-------------------------------|-------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `server` | Yes | `ftp.samkirkland.com` | | Deployment destination server |
|
| `server` | Yes | `ftp.samkirkland.com` | | Deployment destination server |
|
||||||
| `username` | Yes | `username@samkirkland.com` | | FTP user name |
|
| `username` | Yes | `username@samkirkland.com` | | FTP user name |
|
||||||
| `password` | Yes | `CrazyUniquePassword&%123` | | FTP password, be sure to escape quotes and spaces |
|
| `password` | Yes | `CrazyUniquePassword&%123` | | FTP password, be sure to escape quotes and spaces |
|
||||||
| `port` | No | `990` | `21` | Server port to connect to (read your web hosts docs) |
|
| `port` | No | `990` | `21` | Server port to connect to (read your web hosts docs) |
|
||||||
| `protocol` | No | `ftps` | `ftp` | `ftp`: provides no encryption, `ftps`: full encryption newest standard (aka "explicit" ftps), `ftps-legacy`: full encryption legacy standard (aka "implicit" ftps) |
|
| `protocol` | No | `ftps` | `ftp` | `ftp`: provides no encryption, `ftps`: full encryption newest standard (aka "explicit" ftps), `ftps-legacy`: full encryption legacy standard (aka "implicit" ftps) |
|
||||||
| `local-dir` | No | `./myFolderToPublish/` | `./` | Path to upload to on the server, must end with trailing slash `/` |
|
| `local-dir` | No | `./myFolderToPublish/` | `./` | Folder to upload from, must end with trailing slash `/` |
|
||||||
| `server-dir` | No | `public_html/www/` | `./` | Folder to upload from, must end with trailing slash `/` |
|
| `server-dir` | No | `public_html/www/` | `./` | Folder to upload to (on the server), must end with trailing slash `/` |
|
||||||
| `state-name` | No | `folder/.sync-state.json` | `.ftp-deploy-sync-state.json` | Path and name of the state file - this file is used to track which files have been deployed |
|
| `state-name` | No | `folder/.sync-state.json` | `.ftp-deploy-sync-state.json` | Path and name of the state file - this file is used to track which files have been deployed |
|
||||||
| `dry-run` | No | `true` | `false` | Prints which modifications will be made with current config options, but doesn't actually make any changes |
|
| `dry-run` | No | `true` | `false` | Prints which modifications will be made with current config options, but doesn't actually make any changes |
|
||||||
| `dangerous-clean-slate` | No | `true` | `false` | Deletes ALL contents of server-dir, even items in excluded with 'exclude' argument |
|
| `dangerous-clean-slate` | No | `true` | `false` | Deletes ALL contents of server-dir, even items in excluded with 'exclude' argument |
|
||||||
| `exclude` | No | | `[.git*, .git*/**, node_modules/**, node_modules/**/*]` | An array of glob patterns, these files will not be included in the publish/delete process |
|
| `exclude` | No | [See Example](#exclude-files) | [See Example](#exclude-files) | An array of glob patterns, these files will not be included in the publish/delete process. [List MUST be in this format](#exclude-files). You can use [a glob tester](https://www.digitalocean.com/community/tools/glob?comments=true&glob=%2A%2A%2F.git%2A%2F%2A%2A&matches=false&tests=test%2Fsam&tests=.git%2F%0D&tests=.github%2F%0D&tests=.git%2Ftest%0D&tests=.gitattributes%0D&tests=.gitignore%0D&tests=.git%2Fconfig%0D&tests=.git%2Ftest%2Ftest&tests=.github%2Fworkflows%2Fmain.yml&tests=node_modules%2Ffolder%2F%0D&tests=node_modules%2Fotherfolder%2F%0D&tests=subfolder%2Fnode_modules%2F) to test your pattern(s). |
|
||||||
| `log-level` | No | `minimal` | `standard` | `minimal`: only important info, `standard`: important info and basic file changes, `verbose`: print everything the script is doing |
|
| `log-level` | No | `minimal` | `standard` | `minimal`: only important info, `standard`: important info and basic file changes, `verbose`: print everything the script is doing |
|
||||||
| `security` | No | `strict` | `loose` | `strict`: Reject any connection which is not authorized with the list of supplied CAs. `loose`: Allow connection even when the domain is not certificate |
|
| `security` | No | `strict` | `loose` | `strict`: Reject any connection which is not authorized with the list of supplied CAs. `loose`: Allow connection even when the domain is not certificate |
|
||||||
|
| `timeout` | No | `60000` | `30000` | Timeout in milliseconds for FTP operations |
|
||||||
|
|
||||||
|
|
||||||
# Common Examples
|
# Common Examples
|
||||||
@ -85,12 +86,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: 🚚 Get latest code
|
- name: 🚚 Get latest code
|
||||||
uses: actions/checkout@v2.3.2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Use Node.js 12
|
- name: Use Node.js 16
|
||||||
uses: actions/setup-node@v2-beta
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: '12'
|
node-version: '16'
|
||||||
|
|
||||||
- name: 🔨 Build Project
|
- name: 🔨 Build Project
|
||||||
run: |
|
run: |
|
||||||
@ -98,7 +99,7 @@ jobs:
|
|||||||
npm run build
|
npm run build
|
||||||
|
|
||||||
- name: 📂 Sync files
|
- name: 📂 Sync files
|
||||||
uses: SamKirkland/FTP-Deploy-Action@4.0.0
|
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
|
||||||
with:
|
with:
|
||||||
server: ftp.samkirkland.com
|
server: ftp.samkirkland.com
|
||||||
username: myFtpUserName
|
username: myFtpUserName
|
||||||
@ -115,10 +116,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: 🚚 Get latest code
|
- name: 🚚 Get latest code
|
||||||
uses: actions/checkout@v2.3.2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: 📂 Sync files
|
- name: 📂 Sync files
|
||||||
uses: SamKirkland/FTP-Deploy-Action@4.0.0
|
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
|
||||||
with:
|
with:
|
||||||
server: ftp.samkirkland.com
|
server: ftp.samkirkland.com
|
||||||
username: myFtpUserName
|
username: myFtpUserName
|
||||||
@ -127,7 +128,7 @@ jobs:
|
|||||||
port: 1234 # todo replace with your web hosts ftps port
|
port: 1234 # todo replace with your web hosts ftps port
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Log only dry run: Use this mode for testing
|
#### Log only dry run: Use this option for testing
|
||||||
Ouputs a list of files that will be created/modified to sync your source without making any actual changes
|
Ouputs a list of files that will be created/modified to sync your source without making any actual changes
|
||||||
```yml
|
```yml
|
||||||
on: push
|
on: push
|
||||||
@ -138,10 +139,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: 🚚 Get latest code
|
- name: 🚚 Get latest code
|
||||||
uses: actions/checkout@v2.3.2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: 📂 Sync files
|
- name: 📂 Sync files
|
||||||
uses: SamKirkland/FTP-Deploy-Action@4.0.0
|
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
|
||||||
with:
|
with:
|
||||||
server: ftp.samkirkland.com
|
server: ftp.samkirkland.com
|
||||||
username: myFtpUserName
|
username: myFtpUserName
|
||||||
@ -149,6 +150,44 @@ jobs:
|
|||||||
dry-run: true
|
dry-run: true
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Exclude files
|
||||||
|
Excludes files
|
||||||
|
```yml
|
||||||
|
on: push
|
||||||
|
name: 🚀 Deploy website on push
|
||||||
|
jobs:
|
||||||
|
web-deploy:
|
||||||
|
name: 🎉 Deploy
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: 🚚 Get latest code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: 📂 Sync files
|
||||||
|
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
|
||||||
|
with:
|
||||||
|
server: ftp.samkirkland.com
|
||||||
|
username: myFtpUserName
|
||||||
|
password: ${{ secrets.password }}
|
||||||
|
exclude: |
|
||||||
|
**/.git*
|
||||||
|
**/.git*/**
|
||||||
|
**/node_modules/**
|
||||||
|
fileToExclude.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
`exclude` has the following default value
|
||||||
|
```yml
|
||||||
|
exclude: |
|
||||||
|
**/.git*
|
||||||
|
**/.git*/**
|
||||||
|
**/node_modules/**
|
||||||
|
```
|
||||||
|
if you overwrite the default value you will probably want to respecify them
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
_Want another example? Let me know by creating a [github issue](https://github.com/SamKirkland/FTP-Deploy-Action/issues/new)_
|
_Want another example? Let me know by creating a [github issue](https://github.com/SamKirkland/FTP-Deploy-Action/issues/new)_
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -210,7 +249,8 @@ Git files are excluded by default! If you customize the `exclude` option make su
|
|||||||
You can use the `exclude` option to ignore specific files/folders from the publish. Keep in mind you will need to re-add the default exclude options if you want to keep them. For example the below option excludes all `.txt` files.
|
You can use the `exclude` option to ignore specific files/folders from the publish. Keep in mind you will need to re-add the default exclude options if you want to keep them. For example the below option excludes all `.txt` files.
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
exclude: '*.txt'
|
exclude:
|
||||||
|
- *.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
95
action.yml
95
action.yml
@ -1,49 +1,52 @@
|
|||||||
name: 'FTP Deploy'
|
name: "FTP Deploy"
|
||||||
description: 'Automate deploying websites and more with this GitHub action'
|
description: "Automate deploying websites and more with this GitHub action via FTP and FTPS"
|
||||||
author: 'Sam Kirkland'
|
author: "Sam Kirkland"
|
||||||
inputs:
|
inputs:
|
||||||
server:
|
server:
|
||||||
required: true
|
required: true
|
||||||
description: 'ftp server'
|
description: "ftp server"
|
||||||
username:
|
username:
|
||||||
required: true
|
required: true
|
||||||
description: 'ftp username'
|
description: "ftp username"
|
||||||
password:
|
password:
|
||||||
required: true
|
required: true
|
||||||
description: 'ftp password'
|
description: "ftp password"
|
||||||
port:
|
port:
|
||||||
required: false
|
required: false
|
||||||
description: 'Server port to connect to (read your web hosts docs)'
|
description: "Server port to connect to (read your web hosts docs)"
|
||||||
protocol:
|
protocol:
|
||||||
required: false
|
required: false
|
||||||
description: 'protocol to deploy with - ftp, ftps, or ftps-legacy'
|
description: "protocol to deploy with - ftp, ftps, or ftps-legacy"
|
||||||
local-dir:
|
local-dir:
|
||||||
required: false
|
required: false
|
||||||
description: 'Folder to upload from, must end with trailing slash /'
|
description: "Folder to upload from, must end with trailing slash /"
|
||||||
server-dir:
|
server-dir:
|
||||||
required: false
|
required: false
|
||||||
description: 'Path to upload to on the server. Must end with trailing slash /'
|
description: "Path to upload to on the server. Must end with trailing slash /"
|
||||||
state-name:
|
state-name:
|
||||||
required: false
|
required: false
|
||||||
description: 'Path and name of the state file - this file is used to track which files have been deployed'
|
description: "Path and name of the state file - this file is used to track which files have been deployed"
|
||||||
dry-run:
|
dry-run:
|
||||||
required: false
|
required: false
|
||||||
description: 'Prints which modifications will be made with current config options, but doesnt actually make any changes'
|
description: "Prints which modifications will be made with current config options, but doesnt actually make any changes"
|
||||||
dangerous-clean-slate:
|
dangerous-clean-slate:
|
||||||
required: false
|
required: false
|
||||||
description: 'Deletes ALL contents of server-dir, even items in excluded with exclude argument'
|
description: "Deletes ALL contents of server-dir, even items in excluded with exclude argument"
|
||||||
exclude:
|
exclude:
|
||||||
required: false
|
required: false
|
||||||
description: 'An array of glob patterns, these files will not be included in the publish/delete process'
|
description: "An array of glob patterns, these files will not be included in the publish/delete process"
|
||||||
log-level:
|
log-level:
|
||||||
required: false
|
required: false
|
||||||
description: 'How verbose should the information be - warn, info, debug'
|
description: "How verbose should the information be - minimal, standard, or verbose"
|
||||||
security:
|
security:
|
||||||
required: false
|
required: false
|
||||||
description: 'strict or loose'
|
description: "strict or loose"
|
||||||
|
timeout:
|
||||||
|
required: false
|
||||||
|
description: "Timeout in milliseconds for FTP operations"
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: "node20"
|
||||||
main: 'dist/index.js'
|
main: "dist/index.js"
|
||||||
branding:
|
branding:
|
||||||
icon: 'upload-cloud'
|
icon: "upload-cloud"
|
||||||
color: 'orange'
|
color: "blue"
|
||||||
|
4145
dist/index.js
vendored
4145
dist/index.js
vendored
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 12 KiB |
Binary file not shown.
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 7.9 KiB |
@ -1,3 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
preset: "ts-jest"
|
|
||||||
};
|
|
47
migration.md
47
migration.md
@ -1,23 +1,40 @@
|
|||||||
# Migrating from v3 to v4
|
# How to migrate between versions
|
||||||
|
|
||||||
|
## Migrating from v4.1.0 to v4.2.0
|
||||||
|
|
||||||
|
`v4.2.0` parses the `exclude` option in a more standard way. Going forward the `exclude` option **must** be in the following format:
|
||||||
|
|
||||||
|
```yml
|
||||||
|
exclude: |
|
||||||
|
**/.git*
|
||||||
|
**/.git*/**
|
||||||
|
**/node_modules/**
|
||||||
|
fileToExclude.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
## Migrating from v3 to v4
|
||||||
|
|
||||||
Migrating from v3 to v4 should be fairly straightforward. Version 4 was designed with speed and ease of initial setup in mind. Going forward version 4 will be the only supported version.
|
Migrating from v3 to v4 should be fairly straightforward. Version 4 was designed with speed and ease of initial setup in mind. Going forward version 4 will be the only supported version.
|
||||||
|
|
||||||
#### Those who can't upgrade
|
### Those who can't upgrade
|
||||||
Most features have been carried forward and improved upon. However, some features did not make the cut.
|
|
||||||
|
Most features have been carried forward and improved upon. However, some features did not make the cut:
|
||||||
- **`sftp` is no longer supported**. If you have `sftp` access you are using `ssh`, that means you have access to a much more modern and capable protocol. I plan on releasing a separate github action that will deploy over `sftp`/`ssh` using `rsync`. Until then you can continue using version 3.
|
- **`sftp` is no longer supported**. If you have `sftp` access you are using `ssh`, that means you have access to a much more modern and capable protocol. I plan on releasing a separate github action that will deploy over `sftp`/`ssh` using `rsync`. Until then you can continue using version 3.
|
||||||
- The `include` argument has been removed. I didn't see much need for it in the initial release. If you need this feature please create a support ticket.
|
- The `include` argument has been removed. I didn't see much need for it in the initial release. If you need this feature please create a support ticket.
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### How to upgrade
|
### How to upgrade
|
||||||
|
|
||||||
1) Remove `with: fetch-depth: 2`. It is no longer needed and removing it will _slightly_ speed up deployments.
|
1. Remove `with: fetch-depth: 2`. It is no longer needed and removing it will _slightly_ speed up deployments.
|
||||||
2) Change the version to `4.X.X`, for example `SamKirkland/FTP-Deploy-Action@4.0.0` (please check readme for latest version)
|
2. Change the version to `v4.X.X`, for example `SamKirkland/FTP-Deploy-Action@v4.3.5` (please check the [README](https://github.com/SamKirkland/FTP-Deploy-Action/blob/master/README.md) or the [releases page](https://github.com/SamKirkland/FTP-Deploy-Action/releases/latest) for the latest version).
|
||||||
3) If you have a `.git-ftp-include` file you should delete it. Version 4 tracks files differently and no longer needs this config file.
|
3. If you have a `.git-ftp-include` file you should delete it. Version 4 tracks files differently and no longer needs this config file.
|
||||||
4) If you have a `.git-ftp-ignore` file, you should transfer the options to the new `exclude` argument. _Note: Version 4 excludes any `.git*` and `node_modules/` files/folders by default_
|
4. If you have a `.git-ftp-ignore` file, you should transfer the options to the new `exclude` argument. **Note:** version 4 excludes any `.git*` and `node_modules/` files / folders by default.
|
||||||
5) Update your arguments to reflect the following changes
|
5. Update your arguments to reflect the following changes:
|
||||||
* `ftp-server` was split into 4 arguments. `server`, `port`, `protocol`, and `server-dir`. Transfer your config to these options as needed.
|
- `ftp-server` was split into 4 arguments:
|
||||||
* `ftp-username` was renamed to `username`
|
- `server`
|
||||||
* `ftp-password` was renamed to `password`
|
- `port`
|
||||||
* `local-dir` and `server-dir` now **must** end with `/`
|
- `protocol`
|
||||||
* `git-ftp-args` and `known-hosts` arguments were removed
|
- `server-dir`
|
||||||
|
- `ftp-username` was renamed to `username`.
|
||||||
|
- `ftp-password` was renamed to `password`.
|
||||||
|
- `local-dir` and `server-dir` now **must** end with `/`.
|
||||||
|
- `git-ftp-args` and `known-hosts` arguments were removed.
|
||||||
|
8128
package-lock.json
generated
8128
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
32
package.json
32
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ftp-deploy-action",
|
"name": "ftp-deploy-action",
|
||||||
"version": "4.0.0",
|
"version": "4.3.5",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "Automate deploying websites and more with this GitHub action",
|
"description": "Automate deploying websites and more with this GitHub action",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
@ -14,27 +14,31 @@
|
|||||||
"url": "git+https://github.com/SamKirkland/FTP-Deploy-Action.git"
|
"url": "git+https://github.com/SamKirkland/FTP-Deploy-Action.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
"ftp",
|
||||||
"website deploy",
|
"website deploy",
|
||||||
"continuous integration",
|
"continuous integration",
|
||||||
"ftp",
|
|
||||||
"ftps"
|
"ftps"
|
||||||
],
|
],
|
||||||
"author": "Sam Kirkland",
|
"author": "Sam Kirkland",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.9.1",
|
||||||
"@samkirkland/ftp-deploy": "^1.0.3",
|
"@samkirkland/ftp-deploy": "^1.2.4",
|
||||||
"@types/jest": "^26.0.15",
|
"@types/jest": "^29.4.1",
|
||||||
"jest": "^26.6.3",
|
"jest": "^29.5.0",
|
||||||
"ts-jest": "^26.4.4",
|
"ts-jest": "^29.0.5",
|
||||||
"ts-node-dev": "^1.0.0-pre.62"
|
"ts-node-dev": "^2.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^14.0.27",
|
"@types/node": "^20.11.24",
|
||||||
"@typescript-eslint/parser": "^4.0.1",
|
"@typescript-eslint/eslint-plugin": "^5.33.1",
|
||||||
"@vercel/ncc": "^0.24.0",
|
"@typescript-eslint/parser": "^5.33.1",
|
||||||
"eslint": "^7.8.1",
|
"@vercel/ncc": "^0.34.0",
|
||||||
"js-yaml": "^3.14.0",
|
"eslint": "^8.22.0",
|
||||||
"typescript": "^4.0.2"
|
"eslint-plugin-jest": "^26.8.7",
|
||||||
|
"typescript": "^4.7.4"
|
||||||
|
},
|
||||||
|
"jest": {
|
||||||
|
"preset": "ts-jest"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { optionalBoolean, optionalInt, optionalLogLevel, optionalProtocol, optionalSecurity, optionalString, optionalStringArray } from "./parse";
|
import { optionalBoolean, optionalInt, optionalLogLevel, optionalProtocol, optionalSecurity, optionalString } from "./parse";
|
||||||
|
|
||||||
describe("boolean", () => {
|
describe("boolean", () => {
|
||||||
test("false", () => {
|
test("false", () => {
|
||||||
@ -103,33 +103,3 @@ describe("security", () => {
|
|||||||
expect(optionalSecurity("test", "strict")).toBe("strict");
|
expect(optionalSecurity("test", "strict")).toBe("strict");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("array", () => {
|
|
||||||
test("empty", () => {
|
|
||||||
expect(optionalStringArray("test", "")).toEqual(undefined);
|
|
||||||
});
|
|
||||||
|
|
||||||
test("empty array", () => {
|
|
||||||
expect(optionalStringArray("test", "[]")).toEqual([]);
|
|
||||||
});
|
|
||||||
|
|
||||||
test(`["test.txt"]`, () => {
|
|
||||||
expect(optionalStringArray("test", "[test.txt]")).toEqual(["test.txt"]);
|
|
||||||
});
|
|
||||||
|
|
||||||
test(`[ "test.txt" ]`, () => {
|
|
||||||
expect(optionalStringArray("test", "[ test.txt ]")).toEqual(["test.txt"]);
|
|
||||||
});
|
|
||||||
|
|
||||||
test(`["test.txt", "folder/**/*"]`, () => {
|
|
||||||
expect(optionalStringArray("test", "[test.txt, folder/**/*]")).toEqual(["test.txt", "folder/**/*"]);
|
|
||||||
});
|
|
||||||
|
|
||||||
test(`["test.txt", "folder/**/*", "*other"]`, () => {
|
|
||||||
expect(optionalStringArray("test", `test.txt\n - folder/**/*\n - *other`)).toEqual(["test.txt", "folder/**/*", "*other"]);
|
|
||||||
});
|
|
||||||
|
|
||||||
test(`["test.txt", "folder/**/*", "*other"]`, () => {
|
|
||||||
expect(optionalStringArray("test", `\n - test.txt\n - folder/**/*\n - *other`)).toEqual(["test.txt", "folder/**/*", "*other"]);
|
|
||||||
});
|
|
||||||
});
|
|
@ -16,14 +16,15 @@ async function runDeployment() {
|
|||||||
"state-name": optionalString(core.getInput("state-name")),
|
"state-name": optionalString(core.getInput("state-name")),
|
||||||
"dry-run": optionalBoolean("dry-run", core.getInput("dry-run")),
|
"dry-run": optionalBoolean("dry-run", core.getInput("dry-run")),
|
||||||
"dangerous-clean-slate": optionalBoolean("dangerous-clean-slate", core.getInput("dangerous-clean-slate")),
|
"dangerous-clean-slate": optionalBoolean("dangerous-clean-slate", core.getInput("dangerous-clean-slate")),
|
||||||
"exclude": optionalStringArray("exclude", core.getInput("exclude")),
|
"exclude": optionalStringArray("exclude", core.getMultilineInput("exclude")),
|
||||||
"log-level": optionalLogLevel("log-level", core.getInput("log-level")),
|
"log-level": optionalLogLevel("log-level", core.getInput("log-level")),
|
||||||
"security": optionalSecurity("security", core.getInput("security"))
|
"security": optionalSecurity("security", core.getInput("security")),
|
||||||
|
"timeout": optionalInt("timeout", core.getInput("timeout"))
|
||||||
};
|
};
|
||||||
|
|
||||||
await deploy(args);
|
await deploy(args);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error: any) {
|
||||||
core.setFailed(error);
|
core.setFailed(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
18
src/parse.ts
18
src/parse.ts
@ -90,24 +90,14 @@ export function optionalInt(argumentName: string, rawValue: string): number | un
|
|||||||
throw new Error(`${argumentName}: invalid parameter - you provided "${rawValue}". Try a whole number (no decimals) instead like 1234`);
|
throw new Error(`${argumentName}: invalid parameter - you provided "${rawValue}". Try a whole number (no decimals) instead like 1234`);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function optionalStringArray(argumentName: string, rawValue: string): string[] | undefined {
|
export function optionalStringArray(argumentName: string, rawValue: string[]): string[] | undefined {
|
||||||
if (rawValue.length === 0) {
|
if (rawValue.length === 0) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const valueTrim = rawValue.trim();
|
if (typeof rawValue === "string") {
|
||||||
|
throw new Error(`${argumentName}: invalid parameter - you provided "${rawValue}". This option expects an list in the EXACT format described in the readme`);
|
||||||
if (valueTrim.startsWith("[")) {
|
|
||||||
// remove [ and ] - then convert to array
|
|
||||||
return rawValue.replace(/[\[\]]/g, "").trim().split(", ").filter(str => str !== "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// split value by space and comma
|
return rawValue;
|
||||||
const valueAsArrayDouble = rawValue.split(" - ").map(str => str.trim()).filter(str => str !== "");
|
|
||||||
|
|
||||||
if (valueAsArrayDouble.length) {
|
|
||||||
return valueAsArrayDouble;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new Error(`${argumentName}: invalid parameter - you provided "${rawValue}". This option excepts an array in the format [val1, val2] or val1\/n - val2`);
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"moduleResolution": "Node",
|
||||||
"target": "ES2019", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
"target": "ES2019", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
||||||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
||||||
"outDir": "./dist", /* Redirect output structure to the directory. */
|
"outDir": "./dist", /* Redirect output structure to the directory. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user