@@ -40,9 +40,11 @@ async function run() {
4040 // Configure localization.
4141 tl . setResourcePath ( path . join ( __dirname , "task.json" ) ) ;
4242
43- const versioningResult = UnityVersioning . run ( ) ;
44- if ( versioningResult !== 0 ) {
45- const log = `${ tl . loc ( "taskResultFailedVersioning" ) } ${ versioningResult } ` ;
43+ const versioningPreBuildResult = UnityVersioning . runPreBuild ( ) ;
44+ if ( versioningPreBuildResult !== 0 ) {
45+ const log = `${ tl . loc (
46+ "taskResultFailedVersioning"
47+ ) } ${ versioningPreBuildResult } `;
4648 console . error ( log ) ;
4749 tl . setResult ( tl . TaskResult . Failed , log ) ;
4850 return ;
@@ -200,6 +202,20 @@ async function run() {
200202
201203 const result = await UnityToolRunner . run ( unityCmd , logFilePath ) ;
202204
205+ // Only if the project was built successfully, run the post build
206+ // steps of the versioning tool.
207+ if ( result === 0 ) {
208+ const versioningPostBuildResult = UnityVersioning . runPostBuild ( ) ;
209+ if ( versioningPostBuildResult !== 0 ) {
210+ const log = `${ tl . loc (
211+ "taskResultFailedVersioning"
212+ ) } ${ versioningPostBuildResult } `;
213+ console . error ( log ) ;
214+ tl . setResult ( tl . TaskResult . Failed , log ) ;
215+ return ;
216+ }
217+ }
218+
203219 // Unity process has finished. Set task result.
204220 if ( result === 0 ) {
205221 const buildSuccessLog = tl . loc ( "buildSuccess" ) ;
0 commit comments