Extracting files from package based on environment

Hello there!

I have some license files (.lic) I need to distribute to their respective environments using Octopus Deploy.
The licenses are currently in a .zip-folder containing sub-folders for each license file.

I have now uploaded the .zip-folder as a package to my Octopus library. Now I need to add in a script in my deployment step which can extract the correct license file for each environment and transfer the file to a destination path on the target machine.

Could I please have some guidance for this? :slight_smile:

I have created a variable containing the subfolder name within the .zip file for each environment that I expect I need. :slight_smile:

Thanks in advance!

Hi @nmd,

Thanks for getting in touch!

You should be able to do this with a Deploy a Package step, and the custom deployment scripts feature to add a post-deploy script that moves the files to the desired location.

There is a system variable that contains the default package installation folder that should be useful for your script: Octopus.Action.Package.InstallationDirectoryPath

e.g.
Hit the configure features button within the Deploy a Package step

Select the Custom Deployment Scripts feature

Sample pseudo-code to copy the subfolder from the default install path to your desired end location

I hope this helps; let me know if you have any questions.

Regards,
Paul

Thanks for the quick and very detailed reply, Paul!

I will attempt to follow your instructions and update you on the result. :smiley:

2 Likes