Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit b59e533

Browse files
fixed versioning issues; bumped to rc3; moved linker step to build script
1 parent e7f61cb commit b59e533

File tree

5 files changed

+28
-17
lines changed

5 files changed

+28
-17
lines changed

Dockerfile

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,9 @@ RUN TRAVIS_BUILD_NUMBER=$TRAVIS_BUILD_NUMBER \
4242
TRAVIS_BRANCH=$TRAVIS_BRANCH \
4343
dotnet run --project build/build.csproj
4444

45-
FROM build as publish
46-
47-
WORKDIR /src/SqlStreamStore.HAL.DevServer
48-
49-
RUN dotnet add package ILLink.Tasks --version=0.1.5-preview-1841731 --source=https://dotnet.myget.org/F/dotnet-core/api/v3/index.json
50-
RUN dotnet publish --configuration=Release --output=/publish --runtime=alpine.3.7-x64 /p:ShowLinkerSizeComparison=true
51-
5245
FROM microsoft/dotnet:2.1.5-runtime-deps-alpine3.7 AS runtime
5346

5447
WORKDIR /app
55-
COPY --from=publish /publish ./
48+
COPY --from=build /publish ./
5649

5750
ENTRYPOINT ["/app/SqlStreamStore.HAL.DevServer"]

NuGet.Config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<configuration>
33
<packageSources>
44
<add key="sql-stream-store" value="https://www.myget.org/F/sqlstreamstore/api/v3/index.json" />
5+
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
56
</packageSources>
67
</configuration>
78

build/Program.cs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,22 @@
99
static class Program
1010
{
1111
private const string ArtifactsDir = "artifacts";
12+
private const string PublishDir = "publish";
1213

1314
private const string Clean = nameof(Clean);
1415
private const string GenerateDocumentation = nameof(GenerateDocumentation);
1516
private const string Build = nameof(Build);
1617
private const string RunTests = nameof(RunTests);
1718
private const string Pack = nameof(Pack);
1819
private const string Publish = nameof(Publish);
20+
private const string Push = nameof(Push);
1921

2022
public static void Main(string[] args)
2123
{
2224
var buildNumber = GetBuildNumber();
2325
var branch = GetBranch();
2426
var commitHash = GetCommitHash();
25-
var buildMetadata = $"build.{buildNumber}.{branch}.{commitHash}";
27+
var buildMetadata = $"{branch}.{commitHash}";
2628
var apiKey = Environment.GetEnvironmentVariable("MYGET_API_KEY");
2729

2830
Target(Clean, () =>
@@ -31,6 +33,11 @@ public static void Main(string[] args)
3133
{
3234
Directory.Delete(ArtifactsDir, true);
3335
}
36+
if (Directory.Exists(PublishDir))
37+
{
38+
Directory.Delete(PublishDir, true);
39+
}
40+
3441
});
3542

3643
Target(
@@ -71,7 +78,7 @@ public static void Main(string[] args)
7178
DependsOn(GenerateDocumentation),
7279
() => Run(
7380
"dotnet",
74-
$"build src/SqlStreamStore.HAL.sln -c Release /p:BuildMetadata={buildMetadata}"));
81+
$"build src/SqlStreamStore.HAL.sln -c Release /p:BuildNumber={buildNumber} /p:BuildMetadata={buildMetadata}"));
7582

7683
Target(
7784
RunTests,
@@ -81,14 +88,21 @@ public static void Main(string[] args)
8188
$"test src/SqlStreamStore.HAL.Tests -c Release -r ../../{ArtifactsDir} --verbosity normal --no-build -l trx;LogFileName=SqlStreamStore.HAL.Tests.xml"));
8289

8390
Target(
84-
Pack,
91+
Publish,
8592
DependsOn(Build),
8693
() => Run(
8794
"dotnet",
88-
$"pack src/SqlStreamStore.HAL -c Release -o ../../{ArtifactsDir} --no-build"));
95+
$"publish --configuration=Release --output=../../{PublishDir} --runtime=alpine.3.7-x64 /p:ShowLinkerSizeComparison=true /p:BuildNumber={buildNumber} /p:BuildMetadata={buildMetadata} src/SqlStreamStore.HAL.DevServer "));
96+
97+
Target(
98+
Pack,
99+
DependsOn(Publish),
100+
() => Run(
101+
"dotnet",
102+
$"pack src/SqlStreamStore.HAL -c Release -o ../../{ArtifactsDir} /p:BuildNumber={buildNumber} /p:BuildMetadata={buildMetadata} --no-build"));
89103

90104
Target(
91-
Publish,
105+
Push,
92106
DependsOn(Pack),
93107
() =>
94108
{
@@ -109,7 +123,7 @@ public static void Main(string[] args)
109123
}
110124
});
111125

112-
Target("default", DependsOn(Clean, RunTests, Publish));
126+
Target("default", DependsOn(Clean, RunTests, Push));
113127

114128
RunTargets(args);
115129
}
@@ -127,5 +141,5 @@ private static string GetCommitHash()
127141
?? "none";
128142

129143
private static string GetBuildNumber()
130-
=> (Environment.GetEnvironmentVariable("TRAVIS_BUILD_NUMBER") ?? "0").PadLeft(5, '0');
144+
=> (Environment.GetEnvironmentVariable("TRAVIS_BUILD_NUMBER") ?? "0");
131145
}

src/Directory.Build.props

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project>
33
<PropertyGroup>
4+
<BuildNumber Condition="'$(BuildNumber)' == ''">0</BuildNumber>
5+
<BuildMetadata Condition="'$(BuildMetadata)' == ''">local</BuildMetadata>
46
<VersionPrefix>1.0.0</VersionPrefix>
5-
<VersionSuffix>rc2</VersionSuffix>
7+
<VersionSuffix>rc3.$(BuildNumber)</VersionSuffix>
68
<InformationalVersion>$(VersionPrefix)-$(VersionSuffix)+$(BuildMetadata)</InformationalVersion>
79
<Authors>João P. Bragança</Authors>
810
<PackageProjectUrl>https://github.com/SqlStreamStore/SqlStreamStore.HAL</PackageProjectUrl>

src/SqlStreamStore.HAL.DevServer/SqlStreamStore.HAL.DevServer.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<CrossGenDuringPublish>false</CrossGenDuringPublish>
99
</PropertyGroup>
1010
<ItemGroup>
11+
<PackageReference Include="ILLink.Tasks" Version="0.1.5-preview-1841731" />
1112
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.1.1" />
1213
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.1.3" />
1314
<PackageReference Include="Microsoft.AspNetCore.ResponseCompression" Version="2.1.1" />

0 commit comments

Comments
 (0)