Skip to content

Commit e38d85c

Browse files
committed
#2742 - update dockerhub readme on stable releases
1 parent fd3ac39 commit e38d85c

File tree

13 files changed

+154
-7
lines changed

13 files changed

+154
-7
lines changed

.github/workflows/_docker.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,12 @@ jobs:
6060
docker_registry_password: ${{ secrets.DOCKER_PASSWORD }}
6161
github_registry_username: ${{ github.repository_owner }}
6262
github_registry_password: ${{ secrets.DOCKER_GITHUB_TOKEN }}
63+
-
64+
name: DockerHub Publish Readme
65+
if: success() && github.event_name != 'pull_request' && github.repository_owner == 'GitTools' && github.ref_name == 'main'
66+
shell: pwsh
67+
run: dotnet run/docker.dll --target=DockerHubReadmePublish
68+
env:
69+
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
70+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
71+

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ releaseArtifacts
117117
.dotnet
118118
artifacts
119119
!build/artifacts
120-
src/Docker/**/content
120+
build/docker/content
121121
src/PublicAPI.empty.txt
122122

123123
!**/*.cake
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="DockerHub Readme Publish" type="DotNetProject" factoryName=".NET Project" folderName="Docker">
3+
<option name="EXE_PATH" value="$PROJECT_DIR$/../run/docker.exe" />
4+
<option name="PROGRAM_PARAMETERS" value="--target=DockerHubReadmePublish" />
5+
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/.." />
6+
<option name="PASS_PARENT_ENVS" value="1" />
7+
<envs>
8+
<env name="DOCKER_USERNAME" value="" />
9+
<env name="DOCKER_PASSWORD" value="" />
10+
</envs>
11+
<option name="USE_EXTERNAL_CONSOLE" value="0" />
12+
<option name="USE_MONO" value="0" />
13+
<option name="RUNTIME_ARGUMENTS" value="" />
14+
<option name="PROJECT_PATH" value="$PROJECT_DIR$/docker/docker.csproj" />
15+
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
16+
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
17+
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="0" />
18+
<option name="PROJECT_KIND" value="DotNetCore" />
19+
<option name="PROJECT_TFM" value="net7.0" />
20+
<method v="2">
21+
<option name="Build" />
22+
</method>
23+
</configuration>
24+
</component>

build/Directory.Packages.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
<PackageVersion Include="Cake.Codecov" Version="1.0.1" />
88
<PackageVersion Include="Cake.Coverlet" Version="3.0.4" />
99
<PackageVersion Include="Cake.Frosting" Version="3.0.0" />
10+
<PackageVersion Include="Cake.Http" Version="2.0.0" />
1011
<PackageVersion Include="Cake.Incubator" Version="8.0.0" />
1112
<PackageVersion Include="Cake.DotNetLocalTools.Module" Version="3.0.12" />
1213
<PackageVersion Include="Cake.Docker" Version="1.2.0" />
1314
<PackageVersion Include="Cake.Git" Version="3.0.0" />
1415
<PackageVersion Include="Cake.Json" Version="7.0.1" />
1516
<PackageVersion Include="xunit.assert" Version="2.4.2" />
1617
</ItemGroup>
17-
</Project>
18+
</Project>

build/common/Utilities/DockerContextExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static void DockerBuildImage(this BuildContextBase context, DockerImage d
3939

4040
context.Information($"Building image: {dockerImage}");
4141

42-
var workDir = Paths.Src.Combine("Docker");
42+
var workDir = Paths.Build.Combine("docker");
4343
var tags = context.GetDockerTags(dockerImage, arch);
4444

4545
var suffix = arch.ToSuffix();

build/common/Utilities/Models.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public record GitHubCredentials(string Token, string? UserName = null);
1111

1212
public record NugetCredentials(string ApiKey);
1313

14+
public record DockerHubCredentials(string Username, string Password);
15+
1416
public record ChocolateyCredentials(string ApiKey);
1517

1618
public record BuildVersion(GitVersion GitVersion, string? Version, string? Milestone, string? SemVersion, string? NugetVersion, string? ChocolateyVersion, bool IsPreRelease)

build/docker/BuildContext.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
using Common.Utilities;
2+
using Docker.Utilities;
23

34
namespace Docker;
45

56
public class BuildContext : BuildContextBase
67
{
8+
public Credentials? Credentials { get; set; }
79
public bool IsDockerOnLinux { get; set; }
810

911
public IEnumerable<DockerImage> Images { get; set; } = new List<DockerImage>();

build/docker/BuildLifetime.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Common.Lifetime;
22
using Common.Utilities;
3+
using Docker.Utilities;
34

45
namespace Docker;
56

@@ -9,6 +10,8 @@ public override void Setup(BuildContext context, ISetupContext info)
910
{
1011
base.Setup(context, info);
1112

13+
context.Credentials = Credentials.GetCredentials(context);
14+
1215
context.IsDockerOnLinux = context.DockerCustomCommand("info --format '{{.OSType}}'").First().Replace("'", "") == "linux";
1316

1417
var architecture = context.HasArgument(Arguments.Architecture) ? context.Argument<Architecture>(Arguments.Architecture) : (Architecture?)null;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ARG REGISTRY='docker.io'
2-
ARG DISTRO='debian-9'
3-
ARG DOTNET_VERSION='3.1'
4-
ARG VERSION='5.5.1'
2+
ARG DISTRO='debian-11'
3+
ARG DOTNET_VERSION='6.0'
4+
ARG VERSION='5.12.0'
55

66
FROM $REGISTRY/gittools/build-images:$DISTRO-sdk-$DOTNET_VERSION as installer
77
ARG contentFolder

build/docker/Tasks/DockerBuild.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public override bool ShouldRun(BuildContext context)
2121
public override void Run(BuildContext context)
2222
{
2323
var tool = Paths.Nuget.CombineWithFilePath("GitVersion.Tool*");
24-
var dest = Paths.Src.Combine("Docker").Combine("content");
24+
var dest = Paths.Build.Combine("docker").Combine("content");
2525
context.EnsureDirectoryExists(dest);
2626
context.CopyFiles(tool.FullPath, dest);
2727

0 commit comments

Comments
 (0)