Files
sbox-public/engine/Tools/SboxBuild/Steps/WriteVersion.cs
Lorenz Junglas 8bb48bac56 Move Pipelines out of SboxBuild into GitHub yml
Allows us to get rid of a ton of abstraction in SboxBuild, and gets rid of a lot of GitHub API plumbing.
I feel like now that our workflows are more complex it's nicer to just use GitHub directly rather than having our own pipeline abstraction in SboxBuild.
This way we get nicer logging and error reporting, which we can\t achieve through GitHub API.
2026-06-19 13:49:41 +01:00

35 lines
857 B
C#

using static Facepunch.Constants;
namespace Facepunch.Steps;
/// <summary>
/// Step to write version information to a file
/// </summary>
internal class WriteVersion
{
internal ExitCode Run()
{
try
{
Log.Info( "Writing version information..." );
string target = "game/.version";
string contents = $"{Utility.VersionName()}\n" +
$"{Environment.GetEnvironmentVariable( "GITHUB_RUN_ID" )}\n" +
$"{Environment.GetEnvironmentVariable( "GITHUB_JOB" )}\n" +
$"{Environment.GetEnvironmentVariable( "GITHUB_ACTOR" )}\n" +
$"{DateTime.UtcNow}\n";
File.WriteAllText( target, contents );
Log.Info( $"Version information written to {target}" );
return ExitCode.Success;
}
catch ( Exception ex )
{
Log.Error( $"Failed to write version information: {ex}" );
return ExitCode.Failure;
}
}
}