Deploy with tags

I’d like to add git tag in serverless, but not sure how to generate it on fly. I want to use it to follow up the deployment and rollback if required.

For example, I have the latest git tag 1.2.3 in my repository, and need use it to all environment/variable defined in the serviceless stack.

$ cat development.yml

stage: ${opt:stage, self:provider.stage}
service: serverless
tag: ${git describe --abbrev=0 --tags)    # <= how to make this works

Then I can use it as ${self:custom.tag} in serverless stack.

Did you ever figure this out?

I wrote a wrapper script before do the deployment. It doesn’t support in serverless framework currently.

I add my project repos to the CF description so I can hunt down stuff easier later


Uses this script


could you give details on how to put them together and make it work?

self:custom.repo calls this file and gives me the value

1 Like

Hi thanks for this script
I incorporated it as per your excellent example and added the

process.env.repo is still undefined for me
Any thoughts welcome

(it worked great as plain node code but NOT from serverless local custom var)

  repo: ${file(./scripts/git-remote.js):gitUrl}

Does this work with bitbucket cloud? @fearlessfly @DavidWells