diff --git a/src/Nuke/GithubActions/HeadlessRunStep.cs b/src/Nuke/GithubActions/HeadlessRunStep.cs new file mode 100644 index 00000000..c5066df9 --- /dev/null +++ b/src/Nuke/GithubActions/HeadlessRunStep.cs @@ -0,0 +1,38 @@ +namespace Rocket.Surgery.Nuke.GithubActions; + +/// +/// A wrapper around the SetupXvfb step in order to run commands in headless mode +/// +[PublicAPI] +public class HeadlessRunStep : UsingStep +{ + /// + /// The default constructor + /// + /// + public HeadlessRunStep(string name) : base(name) + { + Uses = "coactions/setup-xvfb@v1"; + } + + /// The script to run + public string Run { get; set; } = null!; + + /// + /// The working directory where the script is run + /// + public string? WorkingDirectory { get; set; } + + /// + /// Options to pass to the xvfb server + /// See https://www.x.org/releases/current/doc/man/man1/Xvfb.1.xhtml#heading4 for the list of supported options + /// + public string? Options { get; set; } + + /// + public override void Write(CustomFileWriter writer) + { + WithProperties(x => x.Kebaberize()); + base.Write(writer); + } +}