Deploy with tags


#1

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.


#2

Did you ever figure this out?


#3

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


#4

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

Demo: https://github.com/DavidWells/buslify/blob/master/api/serverless.yml#L65

Uses this script https://github.com/DavidWells/buslify/blob/master/api/scripts/git-remote.js


#5

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


#6

self:custom.repo calls this file and gives me the value https://github.com/DavidWells/buslify/blob/master/api/serverless.yml#L8