I'm new to VSTS and I want to know how to always build only the latest committed SQL Script.
Example: I committed example.sql
from my repository, the VSTS Build needs to get only the "example.sql" zip it and publish the artifact to get ready to release.
How can I do that?
VSTS build all the existing files/scripts of the current working tree (specified branch of the repo).
If you want to zip and publish the latest changed files as artifacts, you can add a PowerShell task (for linux and mac, you can use Shell script task instead) for assistant. Detail steps to detect the changed/added as below:
1. Use PowerShell task to get changed/added file(s) and copy the file(s) from
$(Build.SourcesDirectory)
to another directory (such as$(Build.ArtifactStagingDirectory)\files
). The Powershell script as below:2. Use Archive files task to zip the changed files. Such as from
$(Build.ArtifactStagingDirectory)\files
directory to$(Build.ArtifactStagingDirectory)\pack\$(Build.BuildId).zip
.3. Use Publish Build Artifacts task to publish the zipped file from
$(Build.ArtifactStagingDirectory)\pack
directory.