How to create folders dynamically and upload artifacts in Jfrog artifactory using filespecs in Jenkins?

Viewed 7950

I have a build job in jenkins which builds the project from github for any branch. package will be created in build job workspace with the version as xxxx-yyyyy-2.15.0-SNAPSHOT.zip.

My next artifactory push job has filespec written as below:

{ 
 "files": [
       {
           "pattern": "/var/lib/jenkins/workspace/Jobname/target/*/xxxx-yyyyy*.zip",
           "target": "libs-snapshot-local/xxxx-yyyyy/",
           "recursive": "false"
       }
    ]
}

Above filespec recognize the pattern and upload the zip in libs-snapshot-local/xxxx-yyyyy/. But I need to upload the file with folder created with version name available on the zip file xxxx-yyyyy-2.15.0-SNAPSHOT.zip.

Can anybody help me to create a folder dynamically with version name? any idea on how to specify target path in filespec?

1 Answers
Related