superunitybuild / buildactions

BuildActions for use with the SuperUnityBuild build automation tool.
https://github.com/superunitybuild/buildtool
MIT License
184 stars 38 forks source link

Accessing version info in a Single Run action #31

Closed chemicalcrux closed 1 year ago

chemicalcrux commented 1 year ago

I have a script that uploads my Windows, macOS, and Linux builds to Steam.

Since this script only runs once, it doesn't make sense to use the "Per Platform" action type.

However, if I use the "Single Run" action type, then I cannot access things like the build version -- BuildProject.ResolvePath only gets run for per-platform actions. So, I can't pass a path to the build directory to my script.

I can get around this for now by just using the most recently created build folder, but it'd be nice if I could access constants that aren't platform-specific (e.g. version, build day, etc.) through a single-run action!

robinnorth commented 1 year ago

In an upcoming release of the Build Actions package, ScriptRunner will gain the ability to use $BUILD and $VERSION in input and output paths for single run actions thanks to a rewrite of the string tokens system, so this should get you halfway to your use case.

Build-time related tokens are currently not enabled for single run actions, as they are currently generated from a per-build DateTime, so whilst $YEAR, $MONTH and $DAY would be the same for a single run action as for a series of builds that the action ran before or after, $TIME would be only correspond to the time the single run action was performed. That being said, I think it would probably be fine to enable the usage of these tokens so long as the limitation around $TIME was documented.

robinnorth commented 1 year ago

The $BUILD and $VERSION tokens I mentioned before can now be used by ScriptRunner with the v4.0.0 release of this package 🎉