This Action wraps the Serverless Framework to enable common Serverless commands.
An example workflow to deploy a project with the Serverless Framework:
name: Deploy master branch
on:
push:
branches:
- master
jobs:
deploy:
name: deploy
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- name: serverless deploy
uses: ryanlawson/[email protected]
with:
args: deploy
env:
SERVERLESS_ACCESS_KEY: ${{ secrets.SERVERLESS_ACCESS_KEY }}
# or if using AWS credentials directly
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
with: |
Description | Required | Default |
---|---|---|---|
args |
Arguments passed to serverless |
true |
|
aws-credentials |
Whether to use credentials stored in the local environment (AWS_ACCESS_KEY_ID , AWS_SECRET_ACCESS_KEY ) |
false |
|
install-packages |
Space-separated list of packages to install prior to running serverless {args} |
false |
|
serverless-version |
Version of the Serverless Framework to use | false |
latest |
working-directory |
Folder where your configuration is located | false |
. |
Basic deployment with no customization
- name: Deploy
uses: ryanlawson/[email protected]
with:
args: deploy
Ensures AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
are present and uses them to authenticate
- name: Deploy with local credentials
uses: ryanlawson/[email protected]
with:
aws-credentials: true # or yes
args: deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Installs any additional packages (usually Serverless plugins) prior to deploying
- name: Install packages and deploy
uses: ryanlawson/[email protected]
with:
install-packages: serverless-offline serverless-prune-plugin
args: deploy
Installs a specific version of the Serverless Framework
- name: Deploy using a particular version of serverless
uses: ryanlawson/[email protected]
with:
serverless-version: 2
args: deploy
Sets a specific working directory (usually the root of the repository) for your Serverless configuration
- name: Deploy from a particular working directory
uses: ryanlawson/[email protected]
with:
working-directory: ./foo
args: deploy
The Dockerfile and associated scripts and documentation in this project are released under the Apache-2 license.