Skip to content

Commit ba86a1b

Browse files
committed
v4.2.0 beta
- fixes for 550 folder issue - updated excludes option format
1 parent 65c6a8f commit ba86a1b

8 files changed

+2105
-2408
lines changed

README.md

+38-26
Large diffs are not rendered by default.

dist/index.js

+1,277-146
Large diffs are not rendered by default.

migration.md

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# Migrating from v4.1.0 to v4.2.0
2+
3+
`v4.2.0` parses the `exclude` option in a more standard way.
4+
5+
Going forward the `exclude` option **must** be in the following format
6+
```yml
7+
exclude: |
8+
**/.git*
9+
**/.git*/**
10+
**/node_modules/**
11+
fileToExclude.txt
12+
```
13+
14+
---
15+
116
# Migrating from v3 to v4
217
318
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.

package-lock.json

+756-2,177
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ftp-deploy-action",
3-
"version": "4.1.0",
3+
"version": "4.2.0",
44
"private": true,
55
"description": "Automate deploying websites and more with this GitHub action",
66
"main": "dist/index.js",
@@ -22,20 +22,20 @@
2222
"author": "Sam Kirkland",
2323
"license": "MIT",
2424
"dependencies": {
25-
"@actions/core": "^1.4.0",
26-
"@samkirkland/ftp-deploy": "^1.1.0",
27-
"@types/jest": "^26.0.23",
28-
"jest": "^27.0.5",
29-
"ts-jest": "^27.0.3",
30-
"ts-node-dev": "^1.1.6"
25+
"@actions/core": "^1.6.0",
26+
"@samkirkland/ftp-deploy": "^1.1.1",
27+
"@types/jest": "^27.0.2",
28+
"jest": "^27.2.5",
29+
"ts-jest": "^27.0.5",
30+
"ts-node-dev": "^1.1.8"
3131
},
3232
"devDependencies": {
3333
"@types/node": "^14.0.27",
3434
"@typescript-eslint/eslint-plugin": "^4.28.0",
35-
"@typescript-eslint/parser": "^4.28.0",
36-
"@vercel/ncc": "^0.28.6",
35+
"@typescript-eslint/parser": "^4.33.0",
36+
"@vercel/ncc": "^0.31.1",
3737
"eslint": "^7.29.0",
3838
"eslint-plugin-jest": "^24.3.6",
39-
"typescript": "^4.3.4"
39+
"typescript": "^4.4.3"
4040
}
4141
}

src/main.test.ts

+1-31
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { optionalBoolean, optionalInt, optionalLogLevel, optionalProtocol, optionalSecurity, optionalString, optionalStringArray } from "./parse";
1+
import { optionalBoolean, optionalInt, optionalLogLevel, optionalProtocol, optionalSecurity, optionalString } from "./parse";
22

33
describe("boolean", () => {
44
test("false", () => {
@@ -103,33 +103,3 @@ describe("security", () => {
103103
expect(optionalSecurity("test", "strict")).toBe("strict");
104104
});
105105
});
106-
107-
describe("array", () => {
108-
test("empty", () => {
109-
expect(optionalStringArray("test", "")).toEqual(undefined);
110-
});
111-
112-
test("empty array", () => {
113-
expect(optionalStringArray("test", "[]")).toEqual([]);
114-
});
115-
116-
test(`["test.txt"]`, () => {
117-
expect(optionalStringArray("test", "[test.txt]")).toEqual(["test.txt"]);
118-
});
119-
120-
test(`[ "test.txt" ]`, () => {
121-
expect(optionalStringArray("test", "[ test.txt ]")).toEqual(["test.txt"]);
122-
});
123-
124-
test(`["test.txt", "folder/**/*"]`, () => {
125-
expect(optionalStringArray("test", "[test.txt, folder/**/*]")).toEqual(["test.txt", "folder/**/*"]);
126-
});
127-
128-
test(`["test.txt", "folder/**/*", "*other"]`, () => {
129-
expect(optionalStringArray("test", `test.txt\n - folder/**/*\n - *other`)).toEqual(["test.txt", "folder/**/*", "*other"]);
130-
});
131-
132-
test(`["test.txt", "folder/**/*", "*other"]`, () => {
133-
expect(optionalStringArray("test", `\n - test.txt\n - folder/**/*\n - *other`)).toEqual(["test.txt", "folder/**/*", "*other"]);
134-
});
135-
});

src/main.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ async function runDeployment() {
1616
"state-name": optionalString(core.getInput("state-name")),
1717
"dry-run": optionalBoolean("dry-run", core.getInput("dry-run")),
1818
"dangerous-clean-slate": optionalBoolean("dangerous-clean-slate", core.getInput("dangerous-clean-slate")),
19-
"exclude": optionalStringArray("exclude", core.getInput("exclude")),
19+
"exclude": optionalStringArray("exclude", core.getMultilineInput("exclude")),
2020
"log-level": optionalLogLevel("log-level", core.getInput("log-level")),
2121
"security": optionalSecurity("security", core.getInput("security"))
2222
};
2323

2424
await deploy(args);
2525
}
26-
catch (error) {
26+
catch (error: any) {
2727
core.setFailed(error);
2828
}
2929
}

src/parse.ts

+6-16
Original file line numberDiff line numberDiff line change
@@ -90,24 +90,14 @@ export function optionalInt(argumentName: string, rawValue: string): number | un
9090
throw new Error(`${argumentName}: invalid parameter - you provided "${rawValue}". Try a whole number (no decimals) instead like 1234`);
9191
}
9292

93-
export function optionalStringArray(argumentName: string, rawValue: string): string[] | undefined {
94-
if (rawValue.length === 0) {
95-
return undefined;
96-
}
97-
98-
const valueTrim = rawValue.trim();
99-
100-
if (valueTrim.startsWith("[")) {
101-
// remove [ and ] - then convert to array
102-
return rawValue.replace(/[\[\]]/g, "").trim().split(", ").filter(str => str !== "");
93+
export function optionalStringArray(argumentName: string, rawValue: string[]): string[] | undefined {
94+
if (typeof rawValue === "string") {
95+
throw new Error(`${argumentName}: invalid parameter - you provided "${rawValue}". This option expects an list in the EXACT format described in the readme`);
10396
}
10497

105-
// split value by space and comma
106-
const valueAsArrayDouble = rawValue.split(" - ").map(str => str.trim()).filter(str => str !== "");
107-
108-
if (valueAsArrayDouble.length) {
109-
return valueAsArrayDouble;
98+
if (rawValue.length === 0) {
99+
return undefined;
110100
}
111101

112-
throw new Error(`${argumentName}: invalid parameter - you provided "${rawValue}". This option excepts an array in the format [val1, val2] or val1\/n - val2`);
102+
return rawValue;
113103
}

0 commit comments

Comments
 (0)