From b518774e5ece338f1bb4b79824a6468d10db38d0 Mon Sep 17 00:00:00 2001 From: Nicola Reggiani Date: Wed, 29 Jul 2020 14:37:03 +0200 Subject: [PATCH] Bump to v2 --- README.md | 8 ++++---- dist/index.js | 19 ++++++++++++------- package.json | 2 +- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 42c51ab..e4f9131 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,10 @@ This action is based on the work done by import-io on [s3-deploy](https://github ## Usage -You can use this action by referencing the v1 branch +You can use this action by referencing the v2 branch ```yaml -uses: reggionick/s3-deploy@v1 +uses: reggionick/s3-deploy@v2 with: folder: build bucket: ${{ secrets.S3_BUCKET }} @@ -42,7 +42,7 @@ jobs: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Install dependencies run: yarn @@ -51,7 +51,7 @@ jobs: run: yarn build - name: Deploy - uses: reggionick/s3-deploy@v1 + uses: reggionick/s3-deploy@v2 with: folder: build bucket: ${{ secrets.S3_BUCKET }} diff --git a/dist/index.js b/dist/index.js index 52050b0..9e994b5 100644 --- a/dist/index.js +++ b/dist/index.js @@ -972,16 +972,16 @@ async function run() { const bucket = core.getInput('bucket'); const bucketRegion = core.getInput('bucket-region'); const distId = core.getInput('dist-id'); - const invalidation = core.getInput('invalidation'); + const invalidation = core.getInput('invalidation') || '/'; + const deleteRemoved = core.getInput('delete-removed') || false; - await deploy(folder, bucket, bucketRegion, distId, invalidation); - } - catch (error) { + await deploy({ folder, bucket, bucketRegion, distId, invalidation, deleteRemoved }); + } catch (error) { core.setFailed(error.message); } } -run() +run(); /***/ }), @@ -1006,8 +1006,12 @@ module.exports = require("assert"); const path = __webpack_require__(622); const exec = __webpack_require__(986); -let deploy = function (folder, bucket, bucketRegion, distId, invalidation) { +let deploy = function (params) { return new Promise((resolve, reject) => { + const { folder, bucket, bucketRegion, distId, invalidation, deleteRemoved } = params; + + const deleteRemovedArg = deleteRemoved ? `--deleteRemoved ${deleteRemoved}` : ''; + try { const command = `npx s3-deploy@1.4.0 ./** \ --bucket ${bucket} \ @@ -1017,7 +1021,8 @@ let deploy = function (folder, bucket, bucketRegion, distId, invalidation) { --etag \ --gzip xml,html,htm,js,css,ttf,otf,svg,txt \ --invalidate "${invalidation}" \ - --noCache `; + --noCache \ + ${deleteRemovedArg} `; const cwd = path.resolve(folder); exec.exec(command, [], { cwd }).then(resolve).catch(reject); diff --git a/package.json b/package.json index 1d2b7ba..a21e887 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "github-action-s3-deploy", - "version": "1.1.3", + "version": "2.0.0", "description": "Easily deploy a static website to AWS S3 and invalidate CloudFront distribution", "main": "index.js", "scripts": {