All Projects → appleboy → lambda-action

appleboy / lambda-action

Licence: MIT License
GitHub Action for Deploying Lambda code to an existing function

Programming Languages

go
31211 projects - #10 most used programming language
Dockerfile
14818 projects
shell
77523 projects

Projects that are alternatives of or similar to lambda-action

lambda-layer-tool
Build and publish AWS Lambda layers defined in YAML
Stars: ✭ 22 (-88.83%)
Mutual labels:  lambda
cake-build
Demonstrates a basic build of a .NET NuGet package using https://cakebuild.net/
Stars: ✭ 22 (-88.83%)
Mutual labels:  github-actions
Android-CICD
This repo demonstrates how to work on CI/CD for Mobile Apps 📱 using Github Actions 💊 + Firebase Distribution 🎉
Stars: ✭ 37 (-81.22%)
Mutual labels:  github-actions
all-about-reactJS
I'll be working on 20 different ReactJS projects over the course of 60 days and try to create mobile-first, light and dark themed apps out of them.
Stars: ✭ 15 (-92.39%)
Mutual labels:  github-actions
pipeline-as-code-with-jenkins
Pipeline as Code with Jenkins
Stars: ✭ 56 (-71.57%)
Mutual labels:  lambda
chalice-extended-action
Automated deployment of your Chalice application via Github Actions
Stars: ✭ 18 (-90.86%)
Mutual labels:  github-actions
action-hadolint
Run hadolint with reviewdog 🐶
Stars: ✭ 38 (-80.71%)
Mutual labels:  github-actions
django-security-check
Helps you continuously monitor and fix common security vulnerabilities in your Django application.
Stars: ✭ 69 (-64.97%)
Mutual labels:  github-actions
build-godot-action
GitHub action that builds a Godot project for multiple platforms
Stars: ✭ 62 (-68.53%)
Mutual labels:  github-actions
python-lint
GitHub Action for Lint your code
Stars: ✭ 57 (-71.07%)
Mutual labels:  github-actions
github-act-runner
act as self-hosted runner
Stars: ✭ 68 (-65.48%)
Mutual labels:  github-actions
Tkalc
Basic calculator using Tkinter GUI
Stars: ✭ 17 (-91.37%)
Mutual labels:  lambda
setup-task
GitHub Actions action to make Task available for use in your workflow
Stars: ✭ 14 (-92.89%)
Mutual labels:  github-actions
Multiplatform-Bus
Kotlin event-bus compatible with Android & native iOS
Stars: ✭ 43 (-78.17%)
Mutual labels:  lambda
vale-action
The official GitHub Action for Vale -- install, manage, and run Vale with ease.
Stars: ✭ 76 (-61.42%)
Mutual labels:  github-actions
scorecard-action
Official GitHub Action for OSSF Scorecards.
Stars: ✭ 33 (-83.25%)
Mutual labels:  github-actions
setup-gleam
👷‍♀️ Gleam on GitHub Actions
Stars: ✭ 16 (-91.88%)
Mutual labels:  github-actions
deno-action
Github action for setup Deno
Stars: ✭ 24 (-87.82%)
Mutual labels:  github-actions
auto-card-labeler
GitHub actions to auto label a pull request or an issue based on project card move
Stars: ✭ 33 (-83.25%)
Mutual labels:  github-actions
actions-readme-feed
Display RSS feed in your GitHub Profile README
Stars: ✭ 26 (-86.8%)
Mutual labels:  github-actions

🚀 lambda-action

GitHub Action for deploying Lambda code to an existing function

Usage

Upload zip file to AWS Lambda function.

name: deploy to lambda
on: [push]
jobs:

  deploy_zip:
    name: deploy lambda function
    runs-on: ubuntu-latest
    strategy:
      matrix:
        go-version: [1.13.x]
    steps:
      - name: checkout source code
        uses: actions/checkout@v1
      - name: Install Go
        uses: actions/setup-go@v1
        with:
          go-version: ${{ matrix.go-version }}
      - name: Build binary
        run: |
          cd example && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -a -o main main.go && zip deployment.zip main
      - name: default deploy
        uses: appleboy/lambda-action@master
        with:
          aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws_region: ${{ secrets.AWS_REGION }}
          function_name: gorush
          zip_file: example/deployment.zip
          memory_size: 128
          timeout: 10
          handler: foobar
          role: arn:aws:iam::xxxxxxxxxxx:role/test1234
          runtime: nodejs12.x

Deploy lambda function with source file

name: deploy to lambda
on: [push]
jobs:

  deploy_source:
    name: deploy lambda from source
    runs-on: ubuntu-latest
    steps:
      - name: checkout source code
        uses: actions/checkout@v1
      - name: default deploy
        uses: appleboy/lambda-action@master
        with:
          aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws_region: ${{ secrets.AWS_REGION }}
          function_name: gorush
          source: example/index.js

Set dry run mode to validate the request parameters and access permissions without modifying the function code.

name: deploy to lambda
on: [push]
jobs:

  deploy:
    name: deploy lambda function
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: AWS Lambda Deploy
      uses: appleboy/lambda-action@master
      with:
        aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
        aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        aws_region: ${{ secrets.AWS_REGION }}
        function_name: gorush
        zip_file: output.zip
        dry_run: true

Deploy from a specific branch, master or release.

name: deploy to lambda
on: [push]
jobs:

  deploy:
    name: deploy lambda function
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: AWS Lambda Deploy
      if: github.ref == 'refs/heads/master'
      uses: appleboy/lambda-action@master
      with:
        aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
        aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        aws_region: ${{ secrets.AWS_REGION }}
        function_name: gorush
        zip_file: output.zip
        dry_run: true

Add multiple environment:

name: deploy to lambda
on: [push]
jobs:

  deploy:
    name: deploy lambda function
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: AWS Lambda Deploy
      if: github.ref == 'refs/heads/master'
      uses: appleboy/lambda-action@master
      with:
        aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
        aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        aws_region: ${{ secrets.AWS_REGION }}
        function_name: gorush
        zip_file: output.zip
        dry_run: true
+       environment: foo=bar,author=appleboy

Input variables

See action.yml for more detailed information.

  • aws_region - aws region
  • aws_access_key_id - aws access key id
  • aws_secret_access_key - aws secret key
  • zip_file - file path of zip file
  • source - file list you want to zip
  • s3_bucket - An Amazon S3 bucket in the same AWS Region as your function. The bucket can be in a different AWS account.
  • s3_key - The Amazon S3 key of the deployment package.
  • dry_run - Set to true to validate the request parameters and access permissions without modifying the function code.
  • debug - Show debug message after upload the lambda successfully (default as false).
  • publish - Set to true to publish a new version of the function after updating the code. (default as true).
  • reversion_id - Only update the function if the revision ID matches the ID that is specified.
  • memory_size - The amount of memory that your function has access to. Increasing the function's memory also increases its CPU allocation. The default value is 128 MB. The value must be a multiple of 64 MB.
  • timeout - The amount of time that Lambda allows a function to run before stopping it. The default is 3 seconds. The maximum allowed value is 900 seconds.
  • handler - The name of the method within your code that Lambda calls to execute your function.
  • role - The function's execution role. Pattern: arn:(aws[a-zA-Z-]*)?:iam::\d{12}:role/?[a-zA-Z_0-9+=,.@\-_/]+
  • runtime - The identifier of the function's runtime. nodejs10.x | nodejs12.x | java8 | java8.al2 | java11 | python2.7 | python3.6 | python3.7 | python3.8 | dotnetcore2.1 | dotnetcore3.1 | go1.x | ruby2.5 | ruby2.7 | provided | provided.al2
  • environment - Lambda Environment variables. example: foo=bar,author=appleboy
  • image_uri - URI of a container image in the Amazon ECR registry.
  • subnets - Select the VPC subnets for Lambda to use to set up your VPC configuration.
  • securitygroups - Choose the VPC security groups for Lambda to use to set up your VPC configuration.
  • description - A description of the function.
  • layers - A list of function layers, to add to the function's execution environment. Specify each layer by its ARN, including the version.

See the UpdateFunctionConfiguration for detail information.

AWS Policy

Add the following AWS policy if you want to integrate with GitHub Actions. Please change REGION, ACCOUNT and LAMBDA_NAME variable to your specfic data.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "s3:PutObject",
        "iam:ListRoles",
        "lambda:UpdateFunctionCode",
        "lambda:CreateFunction",
        "lambda:UpdateFunctionConfiguration"
      ],
      "Resource": "arn:aws:lambda:${REGION}:${ACCOUNT}:function:${LAMBDA_NAME}"
    }
  ]
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].