Skip to content

Commit

Permalink
feat: remove publish argument
Browse files Browse the repository at this point in the history
  • Loading branch information
kazimanzurrashid committed Nov 24, 2022
1 parent ad91fd0 commit 8fc5d4c
Showing 4 changed files with 15 additions and 27 deletions.
33 changes: 14 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ only pulls lambda client to update the lambda code.
### minimum

```yaml
uses: kazimanzurrashid/aws-lambda-update-action@v1
uses: kazimanzurrashid/aws-lambda-update-action@v2
with:
zip-file: './dist/my_lambda.zip'
```
@@ -24,7 +24,6 @@ uses: kazimanzurrashid/aws-lambda-update-action@v1
with:
zip-file: './dist/my_lambda.zip'
lambda-name: 'your_lambda'
publish: true
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
@@ -41,7 +40,7 @@ The AWS Account needs to have the `"lambda:UpdateFunctionCode"` permission.
{
"Effect": "Allow",
"Action": ["lambda:UpdateFunctionCode"],
"Resource": "*"
"Resource": "*" // Don't use for production, change it to only your lambda name
}
]
}
@@ -57,10 +56,6 @@ The AWS Account needs to have the `"lambda:UpdateFunctionCode"` permission.

_Optional_. If not specified. it takes the zip file base name as lambda name. (e.g. if the zip file is `my_lambda.zip` it would update `my_lambda` lambda)

### `publish`

_Optional_ The default is `false`.

### `AWS_REGION`

_Optional_, if not specified fallbacks to environment variable.
@@ -92,12 +87,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Node.js setup
uses: actions/setup-node@v2.1.4
uses: actions/setup-node@v3
with:
node-version: 12.x
node-version: 18

- name: Build
run: |
@@ -106,7 +101,7 @@ jobs:
cd dist && zip -r -9 api.zip *
- name: Update
uses: kazimanzurrashid/aws-lambda-update-action@v1
uses: kazimanzurrashid/aws-lambda-update-action@v2
with:
zip-file: dist/api.zip
env:
@@ -128,12 +123,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Go setup
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: 1.15.x
go-version: 1.19

- name: Build
run: |
@@ -143,7 +138,7 @@ jobs:
cd dist && zip -r -9 api.zip *
- name: Update
uses: kazimanzurrashid/aws-lambda-update-action@v1
uses: kazimanzurrashid/aws-lambda-update-action@v2
with:
zip-file: dist/api.zip
env:
@@ -165,12 +160,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: .NET setup
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v3
with:
dotnet-version: 3.1.x
dotnet-version: 6

- name: Lambda.Tools install
run: dotnet tool install -g Amazon.Lambda.Tools
@@ -181,7 +176,7 @@ jobs:
dotnet lambda package -o api.zip
- name: Update
uses: kazimanzurrashid/aws-lambda-update-action@v1
uses: kazimanzurrashid/aws-lambda-update-action@v2
with:
zip-file: src/Api/api.zip
env:
3 changes: 0 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
@@ -11,9 +11,6 @@ inputs:
lambda-name:
required: false
description: 'Optional, if not specified, it uses the file base name as function name'
publish:
description: 'Optional, default is false'
required: false
AWS_REGION:
description: 'Optional if not specified fallbacks to environment variable'
required: false
2 changes: 0 additions & 2 deletions src/action.ts
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@ import { UpdateFunctionCodeCommand } from '@aws-sdk/client-lambda';
interface RunInput {
zipFileLocation: string;
lambdaName: string;
publish: boolean;
}

class Action {
@@ -22,7 +21,6 @@ class Action {

const cmd = new UpdateFunctionCodeCommand({
FunctionName: input.lambdaName,
Publish: input.publish,
ZipFile: zipFile
});

4 changes: 1 addition & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -11,7 +11,6 @@ const getValue = (key: string): string =>

const zipFileLocation = getInput('zip-file', { required: true });
const lambdaName = getInput('lambda-name') || basename(zipFileLocation, '.zip');
const publish = (getInput('publish') || '').toLowerCase() === 'true';

const awsRegion = getValue('AWS_REGION');
const awsAccessKeyId = getValue('AWS_ACCESS_KEY_ID');
@@ -35,8 +34,7 @@ const lambda = new LambdaClient({
info
).run({
zipFileLocation,
lambdaName,
publish
lambdaName
});
} catch (error) {
setFailed(error as Error);

0 comments on commit 8fc5d4c

Please sign in to comment.