Search Unity

Auto-increment app version number through UCB

Discussion in 'Unity Build Automation' started by tsantoro-HS, Sep 5, 2019.

  1. tsantoro-HS

    tsantoro-HS

    Joined:
    Aug 2, 2018
    Posts:
    3
    Hello,

    I've looked through the forums on this topic and couldn't quite find something specific to my problem. We use the versioning system of major.minor.build and were looking to auto-increment the build number every time we kick off a build through UCB. Though, we're running into some roadblocks.

    • I know you can get the UCB build number from the manifest and use that for the build number, but we're going to have multiple build targets, so there's no guarantee the numbers would be same, even if they're all built off the same git commit. For example, a demo of the app may not be built every time we go to make a build, but when it is, we imagined it should have the same version number as the full app.
    • I tried coming up with a solution of having an external file that hosts the current version, which UCB reads during PreExport and increments it if the githash in the manifest is newer than the one in the external file, but as far as I know, you can't do anything asynchronous like downloading a file during PreExport?
    • Then I thought of that file being an asset in the project, but the problem with that is the change in version number wouldn't be saved in the repo after it was changed. And I don't know if it's possible to ask UCB to do a git push for us?
    • The super fallback solution is to use a timestamp instead of a build number, but that's not my favorite solution.
    So unless anyone has a better solution, the two questions I got are:
    1. Is it possible to download a file, hosted on something like an s3 bucket, during PreExport?
    2. Is it possible to ask UCB to do a git push during PreExport or PostExport?
     
  2. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,089
    We had a similar issue but just ending up using the manifest build number. Personally I think it would be fine for downloading a file during PreExport, that's what I was thinking of doing.

    Alternatively, if you're only doing daily builds you can make the build number equal to (number of days minus arbitary day in the calendar).

    Edit: I just tried a test where a file was downloaded in PreExport but it seems to just hang the build process so I probably spoke too soon :(
     
    Last edited: Sep 6, 2019
  3. tsantoro-HS

    tsantoro-HS

    Joined:
    Aug 2, 2018
    Posts:
    3
    Yeah, I saw another thread where someone from Unity said you can't do anything async during PreExport, so you at least can't download a file the normal way.