Compare commits

..

122 Commits

Author SHA1 Message Date
Sam Kirkland
8e83cea867 v4.3.5 2024-03-02 00:37:46 -06:00
Davide Trainini
c15ea8f529
Update migration.md (#389)
Improved pagination, add missing punctuation, delete useless separation lines, improve bullet lists, add link to README and releases page
2023-03-23 11:06:48 -05:00
Sam Kirkland
8a24039354
v4.3.4 (#385)
- updated basic-ftp
- new vx.x.x tags
2023-03-15 00:50:07 -05:00
Sam Kirkland
89e533f02c
Merge pull request #352 from Trainax/glob-tester-link-fix
Glob tester README link fix
2023-02-28 20:23:56 -06:00
Sam Kirkland
cf1b406626
Update README.md 2023-02-28 20:22:37 -06:00
Sam Kirkland
60edb12d91
Merge pull request #342 from Trainax/master
Update actions/checkout to v3
2023-01-20 01:23:24 -06:00
Davide Trainini
28fb6c755c
Glob tester README link fix 2022-12-15 17:42:38 +01:00
Davide Trainini
08c527ecdf Update actions/checkout to v3 2022-12-08 18:47:03 +01:00
Sam Kirkland
cfcb39fa3c
Merge pull request #321 from wcoder/patch-1
Update default timeout info
2022-12-02 10:45:56 -06:00
SamKirkland
1d198bef28 v4.3.3 2022-12-02 10:44:37 -06:00
Sam Kirkland
b8e4443bb0
Merge pull request #338 from the-snowwhite/nodejs_update
Update from node12 to node16
2022-12-02 10:30:34 -06:00
the-snowwhite
84f66893ce Update from node12 to node16
Signed-off-by: the-snowwhite <producer@holotronic.dk>
2022-11-18 21:07:09 +01:00
Yauheni Pakala
0734c4dc18
Update default timeout info
Based on latest 3c410ee1b4/README.md
2022-09-12 23:26:17 +03:00
SamKirkland
ec28745b59 blue marketplace icon 2022-09-03 17:40:42 -05:00
SamKirkland
1b21034a8d v4.3.2 2022-09-03 17:37:57 -05:00
Sam Kirkland
ed91728692
Merge pull request #317 from Marvimoto/patch-1
Add timeout to valid inputs to resolve #316
2022-08-30 09:06:05 -05:00
Marvimoto
118eb423de
Add timeout to valid inputs 2022-08-29 19:14:03 +02:00
Sam Kirkland
e8964f3093
Merge pull request #313 from SamKirkland/4.3.1
4.3.1
2022-08-21 21:28:39 -05:00
SamKirkland
f458cc0704 Merge branch 'master' into 4.3.1 2022-08-21 21:24:37 -05:00
Sam Kirkland
01dea7c17f
Merge pull request #282 from unverbraucht/master
Allow setting the timeout.
2022-08-21 21:24:08 -05:00
SamKirkland
16956be3a6 4.3.1 release
Upgrade basic-ftp library
Update npm libraries
Resolves #308
2022-08-21 21:21:46 -05:00
Kevin Read
4f0dc298db Allow setting the timeout. 2022-04-19 14:36:22 +02:00
Sam Kirkland
d0aa838726
Merge pull request #265 from SamKirkland/v4.3.0-beta
Version 4.3.0
2022-02-19 15:06:06 -06:00
SamKirkland
f55279346a exclude defaults bug fix 2022-01-31 00:44:08 -06:00
SamKirkland
93a0898871 rolling back nested exclude path 2022-01-31 00:11:43 -06:00
SamKirkland
1d31526b7a v4.3.0 2022-01-30 23:37:43 -06:00
SamKirkland
d3fa328f10 550 bug fix 2022-01-30 23:36:06 -06:00
Sam Kirkland
d6ad227aa5
readme example - node version bump (12 -> 14) 2021-12-09 22:26:03 -06:00
SamKirkland
c7bb3d9877 removing clean state 2021-11-22 10:34:05 -06:00
SamKirkland
a7da5e54d2 fixing tests 2021-11-22 10:31:59 -06:00
Sam Kirkland
a9644610a0
Merge pull request #245 from SamKirkland/v4.2.0-beta
V4.2.0
2021-11-22 10:13:59 -06:00
SamKirkland
825d1b8f3b allowing no ecludes 2021-11-13 16:42:30 -06:00
SamKirkland
ba86a1bf13 v4.2.0 beta
- fixes for 550 folder issue
- updated excludes option format
2021-10-13 01:18:45 -05:00
Sam Kirkland
65c6a8f943
Add link to glob testing tool to readme
Fixes #179
2021-06-23 09:11:21 -05:00
Sam Kirkland
d2724c6194
Update ftps.yml 2021-06-23 00:22:15 -05:00
SamKirkland
59992de6c6 v4.1.0
Cert issue - Fixes #149 and Fixes #127
Exceptions now bubble up - Fixes #123
Resolves local-dir incorrect usage - Fixes #145
2021-06-22 23:59:51 -05:00
SamKirkland
408fa95d1f readme: checkout version update 2021-05-16 23:20:17 -05:00
SamKirkland
223d805d5b Reduce image sizes 2021-05-16 23:11:26 -05:00
SamKirkland
3695ee6be8 exclude git example update 2021-05-16 23:06:44 -05:00
Sam Kirkland
ca38d85340
Merge pull request #187 from clarkchentw/patch-1
Fix typo
2021-05-16 23:03:11 -05:00
Clark Chen
a7d2862205
Fix typo 2021-05-09 12:52:30 -05:00
Sam Kirkland
1cffb780cf
Fixing readme local-dir description
fixes #136
2020-12-02 00:16:48 -06:00
Sam Kirkland
2d118d9190
Adding example for exclude 2020-11-23 10:11:50 -06:00
SamKirkland
2a4e9b1312 Resolving sync state issue, added tests
fixes #124
fixes #122
fixes #120
2020-11-23 01:22:34 -06:00
Sam Kirkland
bc95d3edc3
Merge pull request #119 from SamKirkland/4.0.1-patch
4.0.1 patch
2020-11-13 13:58:32 -06:00
SamKirkland
5aee445d73 Update index.js 2020-11-13 13:49:44 -06:00
SamKirkland
3384765d40 removing array log 2020-11-13 13:49:12 -06:00
SamKirkland
6d1a190aef Fixing server sync state location 2020-11-13 13:42:37 -06:00
SamKirkland
8da6fdde60 exclude param - array parsing 2020-11-13 13:25:32 -06:00
SamKirkland
f0ef8012ea local-dir path, excludes param logging 2020-11-13 12:12:25 -06:00
Sam Kirkland
649aa38be8
Merge pull request #117 from SamKirkland/beta-v4
Version 4.0.0
2020-11-13 01:07:57 -06:00
SamKirkland
07d05bff14 version 4 2020-11-13 00:32:29 -06:00
SamKirkland
26175f3bf0 Added badge section 2020-10-25 01:55:55 -05:00
SamKirkland
63b04d6546 updated ftp-deploy with dryrun patch 2020-10-25 00:41:02 -05:00
SamKirkland
928e32c59b back to building with ncc 2020-10-24 00:56:44 -05:00
SamKirkland
c14c34b02c updated ftp-deploy version 2020-10-23 23:41:37 -05:00
SamKirkland
b6b6e42be5 updating ftp-deploy to v0.9.6 2020-09-07 14:57:56 -05:00
SamKirkland
62b6382e92 ftp-deploy update
solved caching issue
updated ftp-deploy library
2020-09-05 01:33:58 -05:00
SamKirkland
c6e7e7c2db Fixed another quote 2020-08-30 23:49:59 -05:00
SamKirkland
64416173e6 fixing yaml quote 2020-08-30 23:45:46 -05:00
SamKirkland
81ee749b94 updating readme 2020-08-30 23:25:49 -05:00
SamKirkland
a923da71e8 updating package 2020-08-30 00:17:42 -05:00
SamKirkland
4fe6844638 more optional props 2020-08-30 00:05:41 -05:00
SamKirkland
fc9de49cd2 import fix, pacakge updates 2020-08-28 01:11:57 -05:00
SamKirkland
afd59edb41 hooked up additional props
added npm badges
Updated readme
2020-08-27 23:43:10 -05:00
SamKirkland
64fd8ab1ea Merge branch 'beta-v4' of https://github.com/SamKirkland/FTP-Deploy-Action into beta-v4 2020-08-27 23:30:48 -05:00
Sam Kirkland
b87fb43f2d
Update index.js 2020-08-26 01:53:25 -05:00
SamKirkland
9e3379feb0 Update index.js 2020-08-26 01:48:20 -05:00
Sam Kirkland
6d051eb8e8
Update README.md 2020-08-26 01:40:07 -05:00
SamKirkland
3576f3af9c v4 beta 2020-08-26 01:28:40 -05:00
Sam Kirkland
1053c3278e
Merge pull request #93 from tflight/patch-2
Add pbcopy tip for macOS users
2020-07-17 18:32:31 -05:00
tflight
acdf4a21c3
Add pbcopy tip for macOS users
This copies the key directly to your clipboard on macOS.
2020-07-17 11:14:16 -04:00
Sam Kirkland
79e6bdd312
Merge pull request #81 from ciex/master
Fix problem setting up known-hosts
2020-07-16 11:09:30 -05:00
Vincent Ahrend
4aadb4a381 Fix known hosts example to include known-hosts arg 2020-06-05 14:32:27 +02:00
Vincent Ahrend
c47227925c Fix missing argument in action.yml 2020-06-05 14:29:03 +02:00
SamKirkland
da0d77ff39 v3.1.1
Bug fix: argument escaping for spaces within passwords
2020-05-17 17:28:14 -05:00
SamKirkland
1af692f7d5 Updating linux testing instructions 2020-05-17 17:25:20 -05:00
SamKirkland
ae5262e007 using act for local debugging
Added act library for local debugging
Attempting to use exec argument escaping
2020-05-17 16:57:25 -05:00
Sam Kirkland
b698c49eac
Merge pull request #72 from Helias/patch-1
Add Linux istructions
2020-05-07 00:25:44 -05:00
Stefano Borzì
ccf756b42e
Add Linux istructions 2020-05-06 18:21:47 +02:00
SamKirkland
f68449776c v3.1.0
Official release of known-hosts
2020-05-05 00:58:08 -05:00
SamKirkland
a54cf4c5e3 Closes #60
Due to node issue using exit code 0 for exceptions thrown in async methods.
Fixed by moving getUserArguments inside try block.
2020-05-02 02:14:10 -05:00
SamKirkland
c42c8e46fb Updating ReadMe FAQ Section 2020-05-02 00:24:55 -05:00
SamKirkland
c926b9df00 Library & test updates
- Updated NPM packages
- Updated tests to point to correct branch (oops)
2020-05-01 23:07:16 -05:00
Sam Kirkland
3f7edaa478
Merge pull request #58 from SamKirkland/dependabot/npm_and_yarn/acorn-5.7.4
Bump acorn from 5.7.3 to 5.7.4
2020-04-04 15:50:05 -05:00
dependabot[bot]
e39df43686
Bump acorn from 5.7.3 to 5.7.4
Bumps [acorn](https://github.com/acornjs/acorn) from 5.7.3 to 5.7.4.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/5.7.3...5.7.4)

Signed-off-by: dependabot[bot] <support@github.com>
2020-04-04 20:46:45 +00:00
Sam Kirkland
586c7242ef
Merge pull request #55 from apokalyptik/master
known_hosts support
2020-04-04 15:45:04 -05:00
Sam Kirkland
97865be6a0
Update README.md
Removed incorrect information about known_hosts expiring
2020-04-04 15:43:55 -05:00
Sam Kirkland
b890f82a46
Update README.md
I tested this out on my host, added commands for windows 10 and moved the docs around a bit
2020-04-02 00:47:59 -05:00
apokalyptik
c9f0bcd878
Update README.md 2020-03-31 10:10:56 -07:00
apokalyptik
481f9001ff
work on formatting 2020-03-31 10:10:10 -07:00
Demitrious Kelly
4938a6057e README update, and rebuild of index.js 2020-03-31 10:00:49 -07:00
Sam Kirkland
af948b8060
Update main.ts
Code Cleanup changes:
- Pulled out this PR into a new function `configureHost`
- Placed args.knownHosts empty at the top of the function, this is known as "fail fast" and helps make the code more readable. Instead of wrapping our code in if/else blocks.
- Converted fs.writeFile to a awaitable function to make it more readable
- Pulled out sshFolder into a const
- Removed `console.log('Wrote ' + process.env['HOME'] + '/.ssh/known_hosts');` logging. Probably not needed because we log ` Configured known_hosts` just 2 lines later
- Small formatting changes

Bug fixes:
- Converted fs.writeFile to a awaitable function, previously the code continued to execute so this could open up a race condition. Also it's more readable :)
 - Race condition example: Previously we asked node to write the file `known_hosts` but we never verified the IO operation completed before modifying the files permission, or deploying the site. If this IO operation wasn't immediate the next function would throw or the deploy would error out.
- Any exception within the new method was swallowed because we had a catch without a throw. In this case let's end the program run instead of attempting to deploy
-
2020-03-30 23:20:38 -05:00
Demitrious Kelly
db3b78d8e7 more spaghetti at the wall [2] 2020-03-25 15:28:33 -07:00
Demitrious Kelly
034d210969 more spaghetti at the wall 2020-03-25 15:15:12 -07:00
Demitrious Kelly
2863e02eda home? 2020-03-25 15:03:56 -07:00
Demitrious Kelly
9315d47124 attempt to create known_hosts 2020-03-25 14:52:17 -07:00
Sam Kirkland
98039f1fbe
Added notes about git-ftp-include 2020-02-20 13:16:57 -06:00
SamKirkland
4895f6f251 v3.0.0
Complete rewrite!
Switched from LFTP to git-ftp
Upload diffs based on git history by default
lower case kebab argument names
Migrated from shell to typescript
Added FTP and SFTP tests
.git-ftp-ignore and .git-ftp-include support
2020-02-18 00:34:10 -06:00
Sam Kirkland
e62d32ee89 Update issue templates 2020-02-11 19:26:23 -06:00
Sam Kirkland
5aed021d1b
Merge pull request #17 from mikeybinnswebdesign/patch-3
Add temporary workaround to ARGS list
2019-11-09 22:20:22 -06:00
Sam Kirkland
bfc3d99cdc
Merge pull request #20 from fabiankaegy/patch-1
remove `(currently only for beta testers)`
2019-11-09 22:19:55 -06:00
Fabian Kägy
319b6d2cd8
remove (currently only for beta testers)
As GitHub actions is no longer in Beta I removed the line of it only being available for beta testers
2019-11-10 01:15:05 +01:00
Mikey Binns
fd3d225df7
Add temporary workaround to ARGS list
I found the temporary workaround you mentioned in this issue to be very beneficial, so I am proposing that it be added to the table of flags. I do also see the argument for not including it though, so this is more to open the discussion.
2019-10-10 09:24:55 +01:00
SamKirkland
9c4e4646b8 v2.0.0
SFTP support!
2019-10-08 00:26:19 -05:00
Sam Kirkland
67f266cff8
Merge pull request #13 from ctrleffive/patch-1
syntax highlighting types in README changed
2019-09-18 09:29:20 -05:00
Chandu J S
f8a41d35d1
syntax highlighting types changed
code example's language type in the file was wrong. changed from `shell` to `yml` and `json` to `workflow`
2019-09-18 17:28:39 +04:00
Sam Kirkland
8bbce4e262
Update README.md 2019-09-17 13:32:01 -05:00
Sam Kirkland
3e99626730
Update action.yml 2019-09-17 09:16:03 -05:00
Sam Kirkland
b4e9e0afae
Merge pull request #11 from Misiu/patch-1
Fix WDEFAULT_ARGS
2019-09-17 08:05:42 -05:00
Tomasz Jagusz
24ffd9c7f3
Fix WDEFAULT_ARGS 2019-09-17 09:00:42 +02:00
Sam Kirkland
e60ff92ee6
Added excluding .git files to FAQ 2019-09-16 15:48:45 -05:00
Sam Kirkland
851cc8a897
Update README.md 2019-09-16 10:49:29 -05:00
Sam Kirkland
aa0baf9dc1
Update entrypoint.sh
Default ARGS
2019-09-16 10:44:36 -05:00
Sam Kirkland
bef03c32a5
Update README.md
Changing fTP to FTP
2019-09-16 10:42:35 -05:00
SamKirkland
0fae300950 Updating ReadMe 2019-09-16 00:55:22 -05:00
SamKirkland
f00166c73a Updated README 2019-09-16 00:00:25 -05:00
SamKirkland
2c3915c100 ARGS pass through props feature
Added ARGS option
Added some more examples
2019-09-15 23:56:38 -05:00
Sam Kirkland
25b4cb7043
Updating readme 2019-08-31 17:11:09 -05:00
Sam Kirkland
fe67ba0caa
Updating README to reflect .yaml changes 2019-08-29 00:21:07 -05:00
Sam Kirkland
d6a63fd397
Merge pull request #2 from filiptronicek/patch-1
Explanation not explination
2019-08-08 15:52:04 -05:00
Filip Troníček
dc0ff7b167
Explanation not explination
Corrected a grammar mistake in README.md
2019-08-08 22:43:57 +02:00
25 changed files with 15180 additions and 97 deletions

2
.eslintignore Normal file
View File

@ -0,0 +1,2 @@
dist/
node_modules/

56
.eslintrc.json Normal file
View File

@ -0,0 +1,56 @@
{
"plugins": [
"jest",
"@typescript-eslint"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 8,
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
"accessibility": "no-public"
}
],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/func-call-spacing": [
"error",
"never"
],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"@typescript-eslint/type-annotation-spacing": "error"
},
"env": {
"node": true,
"es6": true,
"jest/globals": true
}
}

2
.gitattributes vendored
View File

@ -1,2 +0,0 @@
# Auto detect text files and perform LF normalization
* text=auto

27
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,27 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Bug Description**
A clear and concise description of what the bug is.
**My Action Config**
```yaml
on: push
name: Publish Website
jobs:
web-deploy:
name: 🚀 Deploy website every commit
# !!!!!!! TODO Fill Out !!!!!!!
```
**My Action Log**
```
# Paste Log here
# you may want enable verbose logging with log-level: verbose
```

20
.github/workflows/ftp.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: FTP Test
on:
push:
branches: [master]
jobs:
deploy:
name: 🚀 Deploy website every commit
runs-on: ubuntu-latest
steps:
- name: 🚚 Get latest code
uses: actions/checkout@v4
- name: 📂 Sync files
uses: ./
with:
server: ftp.samkirkland.com
username: test@samkirkland.com
password: ${{ secrets.ftp_password }}

21
.github/workflows/ftps.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: FTPS Test
on:
push:
branches: [master]
jobs:
deploy:
name: 🚀 Deploy website every commit
runs-on: ubuntu-latest
steps:
- name: 🚚 Get latest code
uses: actions/checkout@v4
- name: 📂 Sync files
uses: ./
with:
server: ftp.samkirkland.com
username: test@samkirkland.com
password: ${{ secrets.ftp_password }}
protocol: ftps

95
.gitignore vendored Normal file
View File

@ -0,0 +1,95 @@
# Dependency directory
node_modules
# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# OS metadata
.DS_Store
Thumbs.db

View File

@ -1,17 +0,0 @@
FROM alpine:latest
LABEL version="1.0.0"
LABEL repository="https://github.com/SamKirkland/FTP-Deploy-Action"
LABEL homepage="https://github.com/SamKirkland/FTP-Deploy-Action"
LABEL maintainer="Sam Kirkland <FTP-Deploy-Action@samkirkland.com>"
LABEL "com.github.actions.name"="FTP Deploy Action"
LABEL "com.github.actions.description"="Deploy your website via FTP"
LABEL "com.github.actions.icon"="upload-cloud"
LABEL "com.github.actions.color"="orange"
RUN apk add lftp
COPY entrypoint.sh /entrypoint.sh
RUN chmod 777 entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

13
LICENSE
View File

@ -1,6 +1,7 @@
MIT License
Copyright (c) 2019 SamKirkland
The MIT License (MIT)
Copyright (c) 2018 GitHub, Inc. and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -9,13 +10,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

325
README.md
View File

@ -1,73 +1,286 @@
# FTP Deploy for GitHub Actions
<p align="center">
<img alt="FTP Deploy Action - Continuous integration for everyone" src="images/ftp-deploy-logo-small.png">
</p>
Automate deploying websites and more with this GitHub action.
Automate deploying websites and more with this GitHub action. **It's free!**
![Action](images/action.png)
![FTP test](https://github.com/SamKirkland/FTP-Deploy-Action/workflows/FTP%20Test/badge.svg)
![FTPS test](https://github.com/SamKirkland/FTP-Deploy-Action/workflows/FTPS%20Test/badge.svg)
### Usage
```
action "FTP-Deploy-Action" {
uses = "SamKirkland/FTP-Deploy-Action@master"
secrets = ["FTP_USERNAME", "FTP_PASSWORD", "FTP_SERVER"]
}
---
### Usage Example
Place the following in `/.github/workflows/main.yml`
```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.ftp_password }}
```
---
### Requirements
- 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
---
### Setup Steps
1. Select the repository you want to add the action to
2. Select the actions tab `(currently only for beta testers)`
3. Select `Create a new workflow`
4. Select `Edit new file`
5. Paste the above code into the bottom of the file
6. Go back to the `Visual editor`
7. Click edit on the `FTP-Deploy-Action`
8. In the `secrets` section add the required params
* FTP_USERNAME
* FTP_PASSWORD
* FTP_SERVER
* (see optional settings below)
2. Select the `Actions` tab
3. Select `Blank workflow file` or `Set up a workflow yourself`, if you don't see these options manually create a yaml file `Your_Project/.github/workflows/main.yml`
4. Paste the example above into your yaml file and save
5. Now you need to add a key to the `secrets` section in your project. To add a `secret` go to the `Settings` tab in your project then select `Secrets`. Add a new `Secret` for `password`
6. Update your yaml file settings
7. If you appreciate this github action give it a :star: or show off with one of the [badges below](#badge).
---
### Settings
- Options
- __FTP Username__: ${FTP_USERNAME}
- __FTP Password__: ${FTP_PASSWORD}
- __FTP Server__: ${FTP_SERVER}
- __(Optional) Local Dir__: ${LOCAL_DIR}
- __(Optional) Remote Dir__: ${REMOTE_DIR}
- Set actions by editing the action then adding them in the `secrets` section:
- ![Action](images/env.png)
Keys can be added directly to your .yml config file or referenced from your project `Secrets` storage.
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.
| Key Name | Required | Example | Default Value | Description |
|-------------------------|----------|-------------------------------|-------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `server` | Yes | `ftp.samkirkland.com` | | Deployment destination server |
| `username` | Yes | `username@samkirkland.com` | | FTP user name |
| `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) |
| `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/` | `./` | 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 |
| `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 |
| `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 |
| `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 |
### Explination of steps
- This action is triggered by a `event` on your repo
- A docker image based on `mwienk/docker-lftp` is spun up on github servers
- The docker container compresses your code into a tar.gz file
- The file is then uploaded to the remote server
- The file is then un-zipped
# Common Examples
#### Build and Publish React/Angular/Vue Website
Make sure you have an npm script named 'build'. This config should work for most node built websites.
### Debugging locally
###### Instructions for windows
- Install docker for windows
- Open powershell
- Navigate to the repo folder
- Run `docker build --tag action .`
- (Optional) This step is only required when editing entrypoint.sh due to windows editors saving the file with windows line breaks instead of linux line breaks
- Download http://dos2unix.sourceforge.net/
- In another powershell window nagivate to the dos2unix folder /bin
- Run this command every time you modify entrypoint.sh `.\dos2unix.exe "{FULL_PATH_TO_REPO\entrypoint.sh}"`
- Run `docker run action`
```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
###### Instructions for linux
- Please submit a PR for linux instructions :)
- name: Use Node.js 16
uses: actions/setup-node@v2
with:
node-version: '16'
- name: 🔨 Build Project
run: |
npm install
npm run build
- name: 📂 Sync files
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
with:
server: ftp.samkirkland.com
username: myFtpUserName
password: ${{ secrets.password }}
```
#### FTPS
```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 }}
protocol: ftps
port: 1234 # todo replace with your web hosts ftps port
```
#### 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
```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 }}
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
### ToDo
- More config options
- Deploy Mode: ${DEPLOY_MODE} `full`|`diffs`
- SSH support
- Switch from lftp to git
---
Pull Requests Welcome!
_Want another example? Let me know by creating a [github issue](https://github.com/SamKirkland/FTP-Deploy-Action/issues/new)_
### License
----
---
MIT
## Badge
If you appreciate this github action give it a :star: or show off with one of the badges below. Feel free to edit the text or color.
[<img alt="Deployed with FTP Deploy Action" src="https://img.shields.io/badge/Deployed With-FTP DEPLOY ACTION-%3CCOLOR%3E?style=for-the-badge&color=0077b6">](https://github.com/SamKirkland/FTP-Deploy-Action)
```md
[<img alt="Deployed with FTP Deploy Action" src="https://img.shields.io/badge/Deployed With-FTP DEPLOY ACTION-%3CCOLOR%3E?style=for-the-badge&color=0077b6">](https://github.com/SamKirkland/FTP-Deploy-Action)
```
[<img alt="Deployed with FTP Deploy Action" src="https://img.shields.io/badge/Deployed With-FTP DEPLOY ACTION-%3CCOLOR%3E?style=for-the-badge&color=2b9348">](https://github.com/SamKirkland/FTP-Deploy-Action)
```md
[<img alt="Deployed with FTP Deploy Action" src="https://img.shields.io/badge/Deployed With-FTP DEPLOY ACTION-%3CCOLOR%3E?style=for-the-badge&color=2b9348">](https://github.com/SamKirkland/FTP-Deploy-Action)
```
[<img alt="Deployed with FTP Deploy Action" src="https://img.shields.io/badge/Deployed With-FTP DEPLOY ACTION-%3CCOLOR%3E?style=for-the-badge&color=d00000">](https://github.com/SamKirkland/FTP-Deploy-Action)
```md
[<img alt="Deployed with FTP Deploy Action" src="https://img.shields.io/badge/Deployed With-FTP DEPLOY ACTION-%3CCOLOR%3E?style=for-the-badge&color=d00000">](https://github.com/SamKirkland/FTP-Deploy-Action)
```
---
[<img alt="Website Deployed for Free with FTP Deploy Action" src="https://img.shields.io/badge/Website deployed for free with-FTP DEPLOY ACTION-%3CCOLOR%3E?style=for-the-badge&color=297FA9">](https://github.com/SamKirkland/FTP-Deploy-Action)
```md
[<img alt="Website Deployed for Free with FTP Deploy Action" src="https://img.shields.io/badge/Website deployed for free with-FTP DEPLOY ACTION-%3CCOLOR%3E?style=for-the-badge&color=297FA9">](https://github.com/SamKirkland/FTP-Deploy-Action)
```
[<img alt="Website Deployed for Free with FTP Deploy Action" src="https://img.shields.io/badge/Website deployed for free with-FTP DEPLOY ACTION-%3CCOLOR%3E?style=for-the-badge&color=2b9348">](https://github.com/SamKirkland/FTP-Deploy-Action)
```md
[<img alt="Website Deployed for Free with FTP Deploy Action" src="https://img.shields.io/badge/Website deployed for free with-FTP DEPLOY ACTION-%3CCOLOR%3E?style=for-the-badge&color=2b9348">](https://github.com/SamKirkland/FTP-Deploy-Action)
```
[<img alt="Website Deployed for Free with FTP Deploy Action" src="https://img.shields.io/badge/Website deployed for free with-FTP DEPLOY ACTION-%3CCOLOR%3E?style=for-the-badge&color=d00000">](https://github.com/SamKirkland/FTP-Deploy-Action)
```md
[<img alt="Website Deployed for Free with FTP Deploy Action" src="https://img.shields.io/badge/Website deployed for free with-FTP DEPLOY ACTION-%3CCOLOR%3E?style=for-the-badge&color=d00000">](https://github.com/SamKirkland/FTP-Deploy-Action)
```
---
## FAQ
<details>
<summary>How to exclude .git files from the publish</summary>
Git files are excluded by default! If you customize the `exclude` option make sure you re-add the default options.
</details>
<details>
<summary>How to exclude a specific file or folder</summary>
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
exclude:
- *.txt
```
</details>
<details>
<summary>How do I set a upload timeout?</summary>
github has a built-in `timeout-minutes` option, see customized example below
```yaml
on: push
name: Publish Website
jobs:
web-deploy:
name: web-deploy
runs-on: ubuntu-latest
timeout-minutes: 15 # time out after 15 minutes (default is 360 minutes)
steps:
....
```
</details>
## Debugging your config locally
This action is a basic wrapper around my `@samkirkland/ftp-deploy` npm package. To test your config you can install [@samkirkland/ftp-deploy](https://github.com/SamKirkland/ftp-deploy) and then convert your config to a yml action. Settings are one-to-one, this action is only a wrapper.
## Contributing to this project
To test this action locally you will need to setup **docker** and **act** to run a environment similar to the one github uses for actions.
- Download/install docker for windows, make sure it is running
- `choco install act-cli` install [act](https://github.com/nektos/act)
- Install the npm package using `npm install --dev-only @samkirkland/ftp-deploy`
- Update the `deploy` script in `package.json` with a actual server/username/password
- You can run the script using the following command `npm run deploy` (run this in the folder that has the `package.json` file)

52
action.yml Normal file
View File

@ -0,0 +1,52 @@
name: "FTP Deploy"
description: "Automate deploying websites and more with this GitHub action via FTP and FTPS"
author: "Sam Kirkland"
inputs:
server:
required: true
description: "ftp server"
username:
required: true
description: "ftp username"
password:
required: true
description: "ftp password"
port:
required: false
description: "Server port to connect to (read your web hosts docs)"
protocol:
required: false
description: "protocol to deploy with - ftp, ftps, or ftps-legacy"
local-dir:
required: false
description: "Folder to upload from, must end with trailing slash /"
server-dir:
required: false
description: "Path to upload to on the server. Must end with trailing slash /"
state-name:
required: false
description: "Path and name of the state file - this file is used to track which files have been deployed"
dry-run:
required: false
description: "Prints which modifications will be made with current config options, but doesnt actually make any changes"
dangerous-clean-slate:
required: false
description: "Deletes ALL contents of server-dir, even items in excluded with exclude argument"
exclude:
required: false
description: "An array of glob patterns, these files will not be included in the publish/delete process"
log-level:
required: false
description: "How verbose should the information be - minimal, standard, or verbose"
security:
required: false
description: "strict or loose"
timeout:
required: false
description: "Timeout in milliseconds for FTP operations"
runs:
using: "node20"
main: "dist/index.js"
branding:
icon: "upload-cloud"
color: "blue"

9336
dist/index.js vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +0,0 @@
#!/bin/sh
# "to avoid continuing when errors or undefined variables are present"
set -eu
echo "Starting FTP Deploy"
echo "Uploading files..."
WDEFAULT_LOCAL_DIR=${LOCAL_DIR:-"."}
WDEFAULT_REMOTE_DIR=${REMOTE_DIR:-"."}
lftp $FTP_SERVER -u $FTP_USERNAME,$FTP_PASSWORD -e "set ftp:ssl-allow no; mirror -R $WDEFAULT_LOCAL_DIR $WDEFAULT_REMOTE_DIR; quit"
echo "FTP Deploy Complete"
exit 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

40
migration.md Normal file
View File

@ -0,0 +1,40 @@
# 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.
### Those who can't upgrade
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.
- 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
1. Remove `with: fetch-depth: 2`. It is no longer needed and removing it will _slightly_ speed up deployments.
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.
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:
- `ftp-server` was split into 4 arguments:
- `server`
- `port`
- `protocol`
- `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.

4941
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

44
package.json Normal file
View File

@ -0,0 +1,44 @@
{
"name": "ftp-deploy-action",
"version": "4.3.5",
"private": true,
"description": "Automate deploying websites and more with this GitHub action",
"main": "dist/index.js",
"scripts": {
"build": "ncc build src/main.ts --no-cache",
"test": "jest",
"lint": "eslint src/**/*.ts"
},
"repository": {
"type": "git",
"url": "git+https://github.com/SamKirkland/FTP-Deploy-Action.git"
},
"keywords": [
"ftp",
"website deploy",
"continuous integration",
"ftps"
],
"author": "Sam Kirkland",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.9.1",
"@samkirkland/ftp-deploy": "^1.2.4",
"@types/jest": "^29.4.1",
"jest": "^29.5.0",
"ts-jest": "^29.0.5",
"ts-node-dev": "^2.0.0"
},
"devDependencies": {
"@types/node": "^20.11.24",
"@typescript-eslint/eslint-plugin": "^5.33.1",
"@typescript-eslint/parser": "^5.33.1",
"@vercel/ncc": "^0.34.0",
"eslint": "^8.22.0",
"eslint-plugin-jest": "^26.8.7",
"typescript": "^4.7.4"
},
"jest": {
"preset": "ts-jest"
}
}

12
project.code-workspace Normal file
View File

@ -0,0 +1,12 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"files.exclude": {
"**/node_modules": true
}
}
}

105
src/main.test.ts Normal file
View File

@ -0,0 +1,105 @@
import { optionalBoolean, optionalInt, optionalLogLevel, optionalProtocol, optionalSecurity, optionalString } from "./parse";
describe("boolean", () => {
test("false", () => {
expect(optionalBoolean("test", "false")).toBe(false);
});
test("FALSE", () => {
expect(optionalBoolean("test", "FALSE")).toBe(false);
});
test("true", () => {
expect(optionalBoolean("test", "true")).toBe(true);
});
test("TRUE", () => {
expect(optionalBoolean("test", "TRUE")).toBe(true);
});
test("optional", () => {
expect(optionalBoolean("test", "")).toBe(undefined);
});
});
describe("string", () => {
test("empty", () => {
expect(optionalString("")).toBe(undefined);
});
test("populated", () => {
expect(optionalString("test")).toBe("test");
});
});
describe("int", () => {
test("empty", () => {
expect(optionalInt("test", "")).toBe(undefined);
});
test("0", () => {
expect(optionalInt("test", "0")).toBe(0);
});
test("1", () => {
expect(optionalInt("test", "1")).toBe(1);
});
test("500", () => {
expect(optionalInt("test", "500")).toBe(500);
});
test("non-int", () => {
expect(() => optionalInt("test", "12.345")).toThrow();
});
});
describe("protocol", () => {
test("empty", () => {
expect(optionalProtocol("test", "")).toBe(undefined);
});
test("ftp", () => {
expect(optionalProtocol("test", "ftp")).toBe("ftp");
});
test("ftps", () => {
expect(optionalProtocol("test", "ftps")).toBe("ftps");
});
test("ftps-legacy", () => {
expect(optionalProtocol("test", "ftps-legacy")).toBe("ftps-legacy");
});
});
describe("log level", () => {
test("empty", () => {
expect(optionalLogLevel("test", "")).toBe(undefined);
});
test("minimal", () => {
expect(optionalLogLevel("test", "minimal")).toBe("minimal");
});
test("standard", () => {
expect(optionalLogLevel("test", "standard")).toBe("standard");
});
test("verbose", () => {
expect(optionalLogLevel("test", "verbose")).toBe("verbose");
});
});
describe("security", () => {
test("empty", () => {
expect(optionalSecurity("test", "")).toBe(undefined);
});
test("loose", () => {
expect(optionalSecurity("test", "loose")).toBe("loose");
});
test("strict", () => {
expect(optionalSecurity("test", "strict")).toBe("strict");
});
});

32
src/main.ts Normal file
View File

@ -0,0 +1,32 @@
import * as core from "@actions/core";
import { deploy } from "@samkirkland/ftp-deploy";
import { IFtpDeployArguments } from "@samkirkland/ftp-deploy/dist/types";
import { optionalInt, optionalProtocol, optionalString, optionalBoolean, optionalStringArray, optionalLogLevel, optionalSecurity } from "./parse";
async function runDeployment() {
try {
const args: IFtpDeployArguments = {
server: core.getInput("server", { required: true }),
username: core.getInput("username", { required: true }),
password: core.getInput("password", { required: true }),
port: optionalInt("port", core.getInput("port")),
protocol: optionalProtocol("protocol", core.getInput("protocol")),
"local-dir": optionalString(core.getInput("local-dir")),
"server-dir": optionalString(core.getInput("server-dir")),
"state-name": optionalString(core.getInput("state-name")),
"dry-run": optionalBoolean("dry-run", core.getInput("dry-run")),
"dangerous-clean-slate": optionalBoolean("dangerous-clean-slate", core.getInput("dangerous-clean-slate")),
"exclude": optionalStringArray("exclude", core.getMultilineInput("exclude")),
"log-level": optionalLogLevel("log-level", core.getInput("log-level")),
"security": optionalSecurity("security", core.getInput("security")),
"timeout": optionalInt("timeout", core.getInput("timeout"))
};
await deploy(args);
}
catch (error: any) {
core.setFailed(error);
}
}
runDeployment();

103
src/parse.ts Normal file
View File

@ -0,0 +1,103 @@
export function optionalString(rawValue: string): string | undefined {
if (rawValue.length === 0) {
return undefined;
}
return rawValue;
}
export function optionalBoolean(argumentName: string, rawValue: string): boolean | undefined {
if (rawValue.length === 0) {
return undefined;
}
const cleanValue = rawValue.toLowerCase();
if (cleanValue === "true") {
return true;
}
if (cleanValue === "false") {
return false;
}
throw new Error(`${argumentName}: invalid parameter - please use a boolean, you provided "${rawValue}". Try true or false instead.`);
}
export function optionalProtocol(argumentName: string, rawValue: string): "ftp" | "ftps" | "ftps-legacy" | undefined {
if (rawValue.length === 0) {
return undefined;
}
const cleanValue = rawValue.toLowerCase();
if (cleanValue === "ftp") {
return "ftp";
}
if (cleanValue === "ftps") {
return "ftps";
}
if (cleanValue === "ftps-legacy") {
return "ftps-legacy";
}
throw new Error(`${argumentName}: invalid parameter - you provided "${rawValue}". Try "ftp", "ftps", or "ftps-legacy" instead.`);
}
export function optionalLogLevel(argumentName: string, rawValue: string): "minimal" | "standard" | "verbose" | undefined {
if (rawValue.length === 0) {
return undefined;
}
const cleanValue = rawValue.toLowerCase();
if (cleanValue === "minimal") {
return "minimal";
}
if (cleanValue === "standard") {
return "standard";
}
if (cleanValue === "verbose") {
return "verbose";
}
throw new Error(`${argumentName}: invalid parameter - you provided "${rawValue}". Try "minimal", "standard", or "verbose" instead.`);
}
export function optionalSecurity(argumentName: string, rawValue: string): "loose" | "strict" | undefined {
if (rawValue.length === 0) {
return undefined;
}
const cleanValue = rawValue.toLowerCase();
if (cleanValue === "loose") {
return "loose";
}
if (cleanValue === "strict") {
return "strict";
}
throw new Error(`${argumentName}: invalid parameter - you provided "${rawValue}". Try "loose" or "strict" instead.`);
}
export function optionalInt(argumentName: string, rawValue: string): number | undefined {
if (rawValue.length === 0) {
return undefined;
}
const valueAsNumber = parseFloat(rawValue);
if (Number.isInteger(valueAsNumber)) {
return valueAsNumber;
}
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 {
if (rawValue.length === 0) {
return undefined;
}
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`);
}
return rawValue;
}

17
tsconfig.json Normal file
View File

@ -0,0 +1,17 @@
{
"compilerOptions": {
"moduleResolution": "Node",
"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'. */
"outDir": "./dist", /* Redirect output structure to the directory. */
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
"noEmit": true
},
"exclude": [
"node_modules",
"**/.test.ts"
]
}