diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index bccf5ea..242739b 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -18,7 +18,7 @@ jobs: organization: ${{ secrets.ORGANIZATION }} token: ${{ secrets.TOKEN }} certificate: "224b501264c1454d4627268297670451aed3b0d9" - file: "wmi.dll" + file: "*.dll" timestamp_rfc3161_url: "http://timestamp.digicert.com" timestamp_digest_algorithm: "sha256" description: "This is a test file" diff --git a/src/utils.ts b/src/utils.ts index a3b5930..83e4970 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -90,14 +90,19 @@ export interface SignOptions { fileDigestAlgorithm?: string; } -function globFilepathString(artifact: string): string[] { - const split = /[,\n]/ - return artifact.split(split) +function globFilePathString(filePath: string): string[] { + const split = /[,\n]/; + + return filePath.split(split) .map(pathString => pathString.trimStart()) .map(pathString => pathString.split(path.sep).join("/")) - .map(pattern => globSync(pattern)) - .filter((globResult) => statSync(globResult[1]).isDirectory()) - .reduce((accumulated, current) => accumulated.concat(current)) + .map(pattern => { + console.log(globSync(pattern, { mark: true })); + + return globSync(pattern, { mark: true }); + }) + .filter((globResult) => globResult.length) + .reduce((accumulated, current) => accumulated.concat(current), []) } export async function signFile(options: SignOptions) { @@ -164,7 +169,7 @@ export async function signFile(options: SignOptions) { } export async function sign(options: SignOptions) { - const filePaths = globFilepathString(options.file); + const filePaths = globFilePathString(options.file); if (filePaths.length === 0) { throw Error(`Files by specified pattern "${options.file}" did not match any files`); @@ -205,4 +210,4 @@ export async function getSignToolPath(): Promise { } throw new Error('signtool.exe not found'); -} \ No newline at end of file +}