This plugin provides two Serverless variables:
git:stage- branch name converted to camel casegit:basePath- branch name converted to kebab-case which is usefull forserverless-domain-managerplugin
$ npm install --save-dev @purple/serverless-git-branch-stage-pluginAdd the plugin to your serverless.yml file
plugins:
- '@purple/serverless-git-branch-stage-plugin'This plugin requires git to be installed.
Tested on Linux and macOS.
provider:
name: aws
stage: ${git:stage}custom:
customDomain:
domainName: serverless.foo.com
basePath: ${git:basePath}You can override the branch name with envrionment variable SLS_MOCK_BRANCH.
$ SLS_MOCK_BRANCH=master serverless deploy