@@ -11,7 +11,7 @@ public class DockerHubReadmePublish : FrostingTask<BuildContext>;
11
11
12
12
[ TaskName ( nameof ( DockerHubReadmePublishInternal ) ) ]
13
13
[ TaskDescription ( "Publish the DockerHub updated README.md" ) ]
14
- public class DockerHubReadmePublishInternal : FrostingTask < BuildContext >
14
+ public class DockerHubReadmePublishInternal : AsyncFrostingTask < BuildContext >
15
15
{
16
16
public override bool ShouldRun ( BuildContext context )
17
17
{
@@ -24,20 +24,23 @@ public override bool ShouldRun(BuildContext context)
24
24
return shouldRun ;
25
25
}
26
26
27
- public override void Run ( BuildContext context )
27
+ public override async Task RunAsync ( BuildContext context )
28
28
{
29
29
ArgumentNullException . ThrowIfNull ( context . Credentials ? . DockerHub ) ;
30
30
var readme = GetReadmeContent ( context ) ;
31
31
32
- var response = context . HttpPost ( "https://hub.docker.com/v2/users/login" , settings =>
32
+ context . Information ( "Publishing README.md to DockerHub" ) ;
33
+
34
+ context . Information ( "Logging in to DockerHub" ) ;
35
+ var response = await context . HttpPostAsync ( "https://hub.docker.com/v2/users/login" , settings =>
33
36
{
34
37
var credentials = context . Credentials . DockerHub ;
35
38
settings
36
39
. SetContentType ( "application/json" )
37
40
. SetJsonRequestBody ( new { username = credentials . Username , password = credentials . Password } ) ;
38
41
} ) ;
39
42
40
-
43
+ context . Information ( "Updating README.md on DockerHub" ) ;
41
44
context . HttpPatch ( "https://hub.docker.com/v2/repositories/gittools/gitversion" , settings =>
42
45
{
43
46
var token = context . ParseJson ( response ) . Value < string > ( "token" ) ;
@@ -46,6 +49,7 @@ public override void Run(BuildContext context)
46
49
. SetAuthorization ( "JWT" , token )
47
50
. SetJsonRequestBody ( new { full_description = readme } ) ;
48
51
} ) ;
52
+ context . Information ( "README.md updated on DockerHub" ) ;
49
53
}
50
54
51
55
private static string GetReadmeContent ( BuildContextBase context )
0 commit comments