I am trying to create a CICD Pipeline using Travis CI, in which I am creating a tag on my Github using mvn release
plugin.
After creation of a tag, I want to deploy the file created under the tag on my environment. The tag name and the file name is same. For example, demo-1.0.1-app.jar
and tag name is also the same, demo-1.0.1-app
. The file is created under the target
folder and I am able to deploy it using a maven command mvn deploy -Dartifact=target/demo-1.0.1-app.jar
.
But to automate this I was trying to create a variable in the travis.yml
file which would contain git command git describe --abbrev=0 --tags
so that I can pass this variable as file name:
env:
- version = $(git describe --abbrev=0 --tags)
in my script like this: mvn deploy -Dartifact=target/$version.jar
But while running the filename is coming as blank. Please suggest what needs to be done.