Skip to content

Commit 56267c4

Browse files
authored
Merge pull request #3423 from arturcic/feature/2742
Publish updated readme on DockerHub on stable releases
2 parents f8506ae + e38d85c commit 56267c4

File tree

20 files changed

+164
-17
lines changed

20 files changed

+164
-17
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/artifacts/BuildContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace Artifacts;
44

55
public class BuildContext : BuildContextBase
66
{
7-
public string MsBuildConfiguration { get; set; } = Constants.DefaultConfiguration;
7+
public string MsBuildConfiguration { get; } = Constants.DefaultConfiguration;
88

99
public bool IsDockerOnLinux { get; set; }
1010

build/build/Utilities/Credentials.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace Build.Utilities;
44

55
public class Credentials
66
{
7-
public CodeCovCredentials? CodeCov { get; private set; }
7+
public CodeCovCredentials? CodeCov { get; private init; }
88

99
public static Credentials GetCredentials(ICakeContext context) => new()
1010
{

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/common/Utilities/TaskArgumentsAttribute.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ namespace Common.Utilities;
77
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
88
public class TaskArgumentAttribute : Attribute
99
{
10-
public string Name { get; set; }
11-
public string[] PossibleValues { get; set; }
10+
public string Name { get; }
11+
public string[] PossibleValues { get; }
1212
public TaskArgumentAttribute(string name, params string[] possibleValues)
1313
{
1414
Name = name;

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>();

0 commit comments

Comments
 (0)