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