Rename file in Azure Devops Pipeline

Viewed 1747

I have a situation where I need to deploy different stylesheets to different environments (Dev/Test etc).

Is there a way I can edit the publish artefact so I can do a release pipeline for each environment?

  • So I would have a build pipeline that produces theused.css, dev.css, test.css
  • I would have a release pipeline for Dev & Test
  • The dev pipeline would edit the artefact by deleting theused.css then rename dev.css to theused.css .. likewise for test

Or is there a better way to do this?

1 Answers

If I would want to rename a file I would probably write a bash/powershell script and execute it as a task in the pipeline.

Specifically in your case I would copy/rename the dev.css/test.css to theused.css during the deployment step. I do not know how you deploy but you could either rename the .css before the deployment to an S3 bucket for example or if you deploy on an on premise server copy the file and rename it at the same time.

cp /your/dev.css /your/deployed/path/to/theused.css #copying the file
mv /your/dev.css /your/deployed/path/to/theused.css #move/renaming the file
Related