Skip to content

Commit

Permalink
Bump to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Reggionick committed Jul 29, 2020
1 parent c0443b8 commit b518774
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand All @@ -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 }}
Expand Down
19 changes: 12 additions & 7 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();


/***/ }),
Expand All @@ -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 [email protected] ./** \
--bucket ${bucket} \
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit b518774

Please sign in to comment.