'Change serverless.yml stage depending on git branch
I have a nodejs project set up with bitbucket ci/cd - is there any way to programmatically change the Stage from dev to what ever git branch I am on?
Serverless.yml:
stage: ${opt:stage, "dev"}
I have tried to use this package (https://www.npmjs.com/package/serverless-plugin-git-variables) but it doesn't seem to be working.
Solution 1:[1]
Introduction
Hi, a git repo is defined by the hidden .git directory present inside the repo itself, if you are on linux based system you can find the folder using the following command in your terminal inside your project
ls -al
Inside the .git you can find a file called HEAD that contains the current head branch for the project
ie:
ref: refs/heads/3-implement-some feature
Conlcusion
Basically what i mean is that you can access to this file inside your project and define your desired custom logic. I hope this can help you in some way.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | mikrowdev |
