IUnknown
IUnknown

Reputation: 335

Auto increment appx package version after each build

I am looking for a solution to automatically increment a package version (not to be confused with an assembly version) after each build on CI server (particularly Atlassian Bamboo). Every appx package has a version defined in its manifest file (appxmanifest). Thus in order to increase the version a manifest must be edited before commit. I am considering different approaches to implement this. The first one makes changes in manifest and pushes it back to the repo.

  1. Starts building a plan (in order to lock a build number)
  2. Modifies manifest so that a revision is set to the current build number
  3. Pushes changes to SCM (particularly Atlassian Stash). This step shouldn't trigger the next build.
  4. Continues building the package (invoke MSBuild, UT and other tasks)

Cons

  1. Leads to incorrect workflow on Bamboo: checkout -> push -> build
  2. Each build makes a new commit

Another approach is to setup post receive Stash hook which would modify appxmanifest.

Cons Hard to keep a build number in sync with Bamboo.

Is there any other (cleaner and proper) way to achieve this?

Upvotes: 0

Views: 1333

Answers (1)

charleso
charleso

Reputation: 1836

ex-Stash developer here (not that it matters),

I would highly recommend not checking in derived/version information or files. It's going to cause you no end of problems (some of which you have pointed out in your question).

My advice - generate what information you need on the build. I don't know anything about appx packaging, but can you use a placeholder/property (like this) which can be resolved on the Bamboo build? For our builds we use the git hash and timestamp as the version, and in the past I've also used the job/build number (timestamp is better though).

As more food for thought - if that appx version is important for developers to see locally, and it becomes hard to match up with the Git version then you can also attach a Git tag/note to the commit in Bamboo as well. The nice thing about that is that anyone fetching from Git can easily see that extra metadata, but it doesn't result in extra commits for every build. If the appx version need to be based off the previous version then this makes it possible for the build scripts to inspect the previous commit and bump the version appropriately.

I hope that helps.

Upvotes: 1

Related Questions