mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-06 13:28:32 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
35 lines
905 B
C#
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;
|
|
}
|
|
}
|
|
}
|