Files
sbox-public/engine/Tools/SboxBuild/Steps/WriteVersion.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

35 lines
905 B
C#

using static Facepunch.Constants;
namespace Facepunch.Steps;
/// <summary>
/// Step to write version information to a file
/// </summary>
internal class WriteVersion( string name ) : Step( name )
{
protected override ExitCode RunInternal()
{
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;
}
}
}