File tree Expand file tree Collapse file tree 4 files changed +45
-0
lines changed
src/PostSharp.Engineering.BuildTools/Docker Expand file tree Collapse file tree 4 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,16 @@ RUN Invoke-WebRequest -Uri "https://nodejs.org/dist/v22.0.0/node-v22.0.0-win-x64
6868ENV PATH="C:\nodejs;${PATH}"
6969
7070
71+ # Install GitHub CLI
72+ RUN Invoke-WebRequest -Uri https://github.com/cli/cli/releases/download/v2.63.2/gh_2.63.2_windows_amd64.msi -OutFile gh.msi; `
73+ $process = Start-Process msiexec.exe -Wait -PassThru -ArgumentList '/I gh.msi /quiet'; `
74+ if ($process.ExitCode -ne 0) { exit $process.ExitCode }; `
75+ Remove-Item gh.msi
76+
77+ # Add GitHub CLI to PATH using ENV directive (persists across shell switches)
78+ ENV PATH="C:\Program Files\GitHub CLI;${PATH}"
79+
80+
7181# Install Claude CLI
7282# Configure npm global directory to avoid Windows container path issues
7383ENV NPM_CONFIG_PREFIX=C:\npm
Original file line number Diff line number Diff line change @@ -48,5 +48,11 @@ public override void AddRequirements( IReadOnlyList<ContainerComponent> componen
4848 throw new InvalidOperationException (
4949 $ "Claude CLI requires Node.js >= { _minNodeVersion } , but { existingNodeJs . Version } is configured." ) ;
5050 }
51+
52+ // Auto-add GitHubCliComponent if not already present
53+ if ( ! components . OfType < GitHubCliComponent > ( ) . Any ( ) )
54+ {
55+ add ( new GitHubCliComponent ( ) ) ;
56+ }
5157 }
5258}
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ public enum ContainerComponentKind
1717 NodeJs ,
1818 Python ,
1919 Gulp ,
20+ GitHubCli ,
2021 Claude ,
2122 Epilogue
2223}
Original file line number Diff line number Diff line change 1+ // Copyright (c) SharpCrafters s.r.o. See the LICENSE.md file in the root directory of this repository root for details.
2+
3+ using JetBrains . Annotations ;
4+ using System . IO ;
5+
6+ namespace PostSharp . Engineering . BuildTools . Docker ;
7+
8+ [ PublicAPI ]
9+ public sealed class GitHubCliComponent : ContainerComponent
10+ {
11+ public override string Name => "Install GitHub CLI" ;
12+
13+ public override ContainerComponentKind Kind => ContainerComponentKind . GitHubCli ;
14+
15+ public override void WriteDockerfile ( TextWriter writer )
16+ {
17+ writer . WriteLine (
18+ """
19+ RUN Invoke-WebRequest -Uri https://github.com/cli/cli/releases/download/v2.63.2/gh_2.63.2_windows_amd64.msi -OutFile gh.msi; `
20+ $process = Start-Process msiexec.exe -Wait -PassThru -ArgumentList '/I gh.msi /quiet'; `
21+ if ($process.ExitCode -ne 0) { exit $process.ExitCode }; `
22+ Remove-Item gh.msi
23+
24+ # Add GitHub CLI to PATH using ENV directive (persists across shell switches)
25+ ENV PATH="C:\Program Files\GitHub CLI;${PATH}"
26+ """ ) ;
27+ }
28+ }
You can’t perform that action at this time.
0 commit comments