-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add versioning and local credentials
- Loading branch information
1 parent
a1abb42
commit 9e4d135
Showing
3 changed files
with
77 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,16 +46,67 @@ jobs: | |
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
``` | ||
|
||
## Specify a particular version | ||
## Configuration | ||
|
||
| `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` | | | ||
| `entrypoint` | Serverless entrypoint. For example: `/bin/sh` | `false` | `/entrypoint.sh` | | ||
| `install-packages` | Comma-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` | `.` | | ||
|
||
## Examples | ||
|
||
### Minimal example | ||
```yaml | ||
- name: Deploy | ||
uses: serverless/[email protected] | ||
with: | ||
args: deploy | ||
``` | ||
### Use local credentials | ||
```yaml | ||
- name: Deploy with local credentials | ||
uses: serverless/[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 }} | ||
``` | ||
### Use a different entrypoint | ||
```yaml | ||
- name: Deploy with a different entrypoint | ||
uses: serverless/[email protected] | ||
with: | ||
entrypoint: /bin/sh | ||
args: -c "serverless deploy" | ||
``` | ||
### Install packages and deploy | ||
```yaml | ||
- name: Install packages and deploy | ||
uses: serverless/[email protected] | ||
with: | ||
install-packages: serverless-offline,serverless-prune-plugin | ||
args: deploy | ||
``` | ||
### Use a particular Serverless Framework CLI version | ||
```yaml | ||
- name: Deploy with a particular version | ||
- name: Deploy using a particular version of serverless | ||
uses: serverless/[email protected] | ||
with: | ||
serverless-version: 3 | ||
serverless-version: 2 | ||
args: deploy | ||
``` | ||
## Change your working directory | ||
### Change your working directory | ||
```yaml | ||
- name: Deploy from a particular working directory | ||
uses: serverless/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,15 @@ | ||
#!/bin/sh -l | ||
cd $1 | ||
npm i -g serverless@${2/v/} | ||
serverless $3 | ||
npm i -g serverless@$2 | ||
|
||
PACKAGES_TO_INSTALL=$3 | ||
if [[ $3 != "none" ]]; then | ||
npm i -g ${PACKAGES_TO_INSTALL//,/\ } | ||
fi | ||
|
||
WITH_LOCAL_CREDENTIALS="" | ||
if [[ $4 == "true" ]] || [[ $4 == "yes" ]]; then | ||
WITH_LOCAL_CREDENTIALS="--use-local-credentials" | ||
fi | ||
|
||
serverless $5 $WITH_LOCAL_CREDENTIALS |