Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get TeamCity to zip a zip file

Tags:

zip

teamcity

My problem: I have build on TeamCity that produces a zip file: Files.zip It contains lots of files, and a zip file is a good container for the files.

Sadly though, and due to legacy reasons, the zip file has no version number in it's title. I would like it to have a version number in it. Like this: Files.1.2.3.4.zip

I thought that maybe I could create a containing zip, that I can adorn with a version number, like this: ContainingZip.1.2.3.4.zip!Files.zip So that Files.zip is zipped into another zip! (Madness).

But I cannot work out how to do that through TeamCity and it's artifact paths?

What I feel should work is: /**/. => Files.Zip => ContainingZip.1.2.3.4.zip!Files.zip But that just makes Files.Zip

Breaking it into two steps, works not too: /**/. => Files.Zip Files.Zip => ContainingZip.1.2.3.4.zip This doesn't work either as Files.zip doesn't exist when the artifact existence checks are done.

Anyone know how to do this? (Or do I have to pre-zip in a build step?)

Thanks.

like image 513
TinyRacoon Avatar asked Nov 08 '22 21:11

TinyRacoon


1 Answers

Answer: TeamCity will not let you double zip in the artifact window. You have to use a build step.

Which you can do...

Via a PowerShell build step you can use Compress-Archive if you have PowerShell 5+. Or there is good infomation here http://stackoverflow.com/questions/1153126/how-to-create-a-zip-archive-with-powershell for older PowerShell versions.

Via an Ant build step:

<?xml version="1.0" encoding="UTF-8"?>
<project name="zipper" default="zip" basedir=".">

<property name="project-name" value="Files.zip" />
<property name="folder-to-zip" value="./FolderToZip/" />

<target name="zip">
<delete file="${project-name}" />
<zip destfile="${project-name}" basedir="${folder-to-zip}" excludes="${project-name}" />
</target>
</project>
like image 55
TinyRacoon Avatar answered Jan 04 '23 02:01

TinyRacoon