diff --git a/README.md b/README.md index 3669af3..1482aa8 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ Input | Type | Required | Default | Description | `noCache` | boolean | No | false | Use this parameter to specify `Cache-Control: no-cache, no-store, must-revalidate` header | `private` | boolean | No | false | Upload files with private ACL, needed for S3 static website hosting | `cache` | string | No | | Sets the Cache-Control: max-age=X header +| `filesToInclude` | string | No | "**" | Allows for a comma delineated Regex String that matches files to include in the deployment ### Example `workflow.yml` with S3 Deploy Action @@ -64,6 +65,7 @@ jobs: delete-removed: true no-cache: true private: true + filesToInclude: ".*/*,*/*,**" ``` ## License diff --git a/action.yml b/action.yml index d2f4a89..7f6c868 100644 --- a/action.yml +++ b/action.yml @@ -28,6 +28,9 @@ inputs: cache: description: 'Sets the Cache-Control: max-age=X header' required: false + filesToInclude: + description: 'Allows for a comma delineated Regex String that matches files to include in the deployment' + required: false runs: using: 'node12' main: 'dist/index.js' diff --git a/deploy.js b/deploy.js index c7679e1..fed83c9 100644 --- a/deploy.js +++ b/deploy.js @@ -3,7 +3,7 @@ const exec = require('@actions/exec'); let deploy = function (params) { return new Promise((resolve, reject) => { - const { folder, bucket, bucketRegion, distId, invalidation, deleteRemoved, noCache, private, cache } = params; + const { folder, bucket, bucketRegion, distId, invalidation, deleteRemoved, noCache, private, cache, filesToInclude } = params; const distIdArg = distId ? `--distId ${distId}` : ''; const invalidationArg = distId ? `--invalidate "${invalidation}"` : ''; @@ -16,9 +16,10 @@ let deploy = function (params) { const noCacheArg = noCache ? '--noCache' : ''; const privateArg = private ? '--private' : ''; const cacheFlag = cache ? `--cache ${cache}` : ''; + const filesRegex = filesToInclude ? filesToInclude : '**'; try { - const command = `npx s3-deploy@1.4.0 ./** \ + const command = `npx s3-deploy@1.4.0 ./${filesRegex} \ --bucket ${bucket} \ --region ${bucketRegion} \ --cwd ./ \ diff --git a/index.js b/index.js index a220ede..89fea12 100644 --- a/index.js +++ b/index.js @@ -16,8 +16,9 @@ async function run() { const noCache = getBooleanInput('no-cache'); const private = getBooleanInput('private'); const cache = core.getInput('cache') || null; + const filesToInclude = core.getInput('files-to-include') || null; - await deploy({ folder, bucket, bucketRegion, distId, invalidation, deleteRemoved, noCache, private, cache }); + await deploy({ folder, bucket, bucketRegion, distId, invalidation, deleteRemoved, noCache, private, cache, filesToInclude }); } catch (error) { core.setFailed(error.message); } diff --git a/package-lock.json b/package-lock.json index 70469d0..b7b46d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2131,7 +2131,6 @@ "minipass": { "version": "2.3.5", "bundled": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -2327,8 +2326,7 @@ }, "safe-buffer": { "version": "5.1.2", - "bundled": true, - "optional": true + "bundled": true }, "safer-buffer": { "version": "2.1.2", @@ -2418,8 +2416,7 @@ }, "yallist": { "version": "3.0.3", - "bundled": true, - "optional": true + "bundled": true } } },