@@ -12,6 +12,12 @@ public class App
1212 private readonly IProcessService _processService ;
1313 private readonly IConfigurationService _configurationService ;
1414
15+ public bool IsPrerelease { get ; set ; }
16+
17+ private string ImageTag => IsPrerelease ? "pre" : "latest" ;
18+
19+ private string ImageName => $ "{ ActionsImporterImage } :{ ImageTag } ";
20+
1521 public App ( IDockerService dockerService , IProcessService processService , IConfigurationService configurationService )
1622 {
1723 _dockerService = dockerService ;
@@ -37,7 +43,7 @@ public async Task<int> UpdateActionsImporterAsync(string? username = null, strin
3743 await _dockerService . UpdateImageAsync (
3844 ActionsImporterImage ,
3945 ActionsImporterContainerRegistry ,
40- "latest" ,
46+ ImageTag ,
4147 username ,
4248 password ,
4349 passwordStdin
@@ -52,13 +58,14 @@ public async Task<int> ExecuteActionsImporterAsync(string[] args)
5258 await _dockerService . VerifyImagePresentAsync (
5359 ActionsImporterImage ,
5460 ActionsImporterContainerRegistry ,
55- "latest"
61+ ImageTag ,
62+ IsPrerelease
5663 ) . ConfigureAwait ( false ) ;
5764
5865 await _dockerService . ExecuteCommandAsync (
5966 ActionsImporterImage ,
6067 ActionsImporterContainerRegistry ,
61- "latest" ,
68+ ImageTag ,
6269 args . Select ( x => x . EscapeIfNeeded ( ) ) . ToArray ( )
6370 ) ;
6471 return 0 ;
@@ -68,7 +75,7 @@ public async Task<int> GetVersionAsync()
6875 {
6976 var ( standardOutput , standardError , exitCode ) = await _processService . RunAndCaptureAsync ( "gh" , "version" ) ;
7077 var ghActionsImporterVersion = await _processService . RunAndCaptureAsync ( "gh" , "extension list" ) ;
71- var actionsImporterVersion = await _processService . RunAndCaptureAsync ( "docker" , $ "run --rm { ActionsImporterContainerRegistry } /{ ActionsImporterImage } :latest version", throwOnError : false ) ;
78+ var actionsImporterVersion = await _processService . RunAndCaptureAsync ( "docker" , $ "run --rm { ActionsImporterContainerRegistry } /{ ImageName } version", throwOnError : false ) ;
7279
7380 var formattedGhVersion = standardOutput . Split ( Environment . NewLine , StringSplitOptions . RemoveEmptyEntries | StringSplitOptions . TrimEntries ) . FirstOrDefault ( ) ;
7481 var formattedGhActionsImporterVersion = ghActionsImporterVersion . standardOutput . Split ( Environment . NewLine , StringSplitOptions . RemoveEmptyEntries | StringSplitOptions . TrimEntries )
@@ -77,7 +84,7 @@ public async Task<int> GetVersionAsync()
7784
7885 Console . WriteLine ( formattedGhVersion ) ;
7986 Console . WriteLine ( formattedGhActionsImporterVersion ) ;
80- Console . WriteLine ( $ "actions-importer/cli\t { formattedActionsImporterVersion } ") ;
87+ Console . WriteLine ( $ "actions-importer/cli: { ImageTag } \t { formattedActionsImporterVersion } ") ;
8188
8289 return 0 ;
8390 }
@@ -86,8 +93,8 @@ public async Task CheckForUpdatesAsync()
8693 {
8794 try
8895 {
89- var latestImageDigestTask = _dockerService . GetLatestImageDigestAsync ( ActionsImporterImage , ActionsImporterContainerRegistry ) ;
90- var currentImageDigestTask = _dockerService . GetCurrentImageDigestAsync ( ActionsImporterImage , ActionsImporterContainerRegistry ) ;
96+ var latestImageDigestTask = _dockerService . GetLatestImageDigestAsync ( ImageName , ActionsImporterContainerRegistry ) ;
97+ var currentImageDigestTask = _dockerService . GetCurrentImageDigestAsync ( ImageName , ActionsImporterContainerRegistry ) ;
9198
9299 await Task . WhenAll ( latestImageDigestTask , currentImageDigestTask ) ;
93100
0 commit comments