diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a3793c5..ee72be1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,47 +25,17 @@ on: - 'v*.*.*' jobs: - macos-latest: - name: macos-latest - runs-on: macos-latest - steps: - - uses: actions/checkout@v3 - - name: 'Run: Compile, Test, Pack' - run: ./build.cmd Compile Test Pack - - name: 'Publish: test-results' - uses: actions/upload-artifact@v3 - with: - name: test-results - path: artifacts/test-results - - name: 'Publish: packages' - uses: actions/upload-artifact@v3 - with: - name: packages - path: artifacts/packages ubuntu-latest: name: ubuntu-latest runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: 'Run: Compile, Test, Pack' - run: ./build.cmd Compile Test Pack - - name: 'Publish: test-results' - uses: actions/upload-artifact@v3 - with: - name: test-results - path: artifacts/test-results - - name: 'Publish: packages' - uses: actions/upload-artifact@v3 - with: - name: packages - path: artifacts/packages - windows-latest: - name: windows-latest - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - name: 'Run: Compile, Test, Pack' - run: ./build.cmd Compile Test Pack + - name: 'Run: Compile, Test, Pack, Publish' + run: ./build.cmd Compile Test Pack Publish + env: + FeedzNuGetApiKey: ${{ secrets.FEEDZ_NUGET_API_KEY }} + PublicNuGetApiKey: ${{ secrets.PUBLIC_NUGET_API_KEY }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: 'Publish: test-results' uses: actions/upload-artifact@v3 with: diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index 3f9224e..be7439b 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -17,6 +17,10 @@ "type": "boolean", "description": "Indicates to continue a previously failed build attempt" }, + "FeedzNuGetApiKey": { + "type": "string", + "default": "Secrets must be entered via 'nuke :secrets [profile]'" + }, "Help": { "type": "boolean", "description": "Shows the help text for this build assembly" @@ -65,6 +69,10 @@ "type": "string" } }, + "PublicNuGetApiKey": { + "type": "string", + "default": "Secrets must be entered via 'nuke :secrets [profile]'" + }, "Root": { "type": "string", "description": "Root directory during build execution" @@ -78,6 +86,7 @@ "Clean", "Compile", "Pack", + "Publish", "Restore", "Test" ] @@ -96,6 +105,7 @@ "Clean", "Compile", "Pack", + "Publish", "Restore", "Test" ] diff --git a/Directory.Build.props b/Directory.Build.props index b72b5d9..4a359af 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -4,6 +4,7 @@ 12 enable nullable + 0.1.0 diff --git a/build/Build.CI.GitHubActions.cs b/build/Build.CI.GitHubActions.cs index cf2ae17..26a0a35 100644 --- a/build/Build.CI.GitHubActions.cs +++ b/build/Build.CI.GitHubActions.cs @@ -15,14 +15,14 @@ ] [GitHubActions( "build", - GitHubActionsImage.MacOsLatest, GitHubActionsImage.UbuntuLatest, - GitHubActionsImage.WindowsLatest, OnPushBranches = ["main", "master"], OnPushTags = ["v*.*.*"], PublishArtifacts = true, - InvokedTargets = [nameof(ICompile.Compile), nameof(ITest.Test), nameof(IPack.Pack)], - CacheKeyFiles = [] + InvokedTargets = [nameof(ICompile.Compile), nameof(ITest.Test), nameof(IPack.Pack), nameof(IPublish.Publish)], + CacheKeyFiles = [], + EnableGitHubToken = true, + ImportSecrets = [nameof(FeedzNuGetApiKey), nameof(PublicNuGetApiKey)] ) ] public partial class Build; diff --git a/build/Build.cs b/build/Build.cs index 939e5c1..d17dcd6 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -3,7 +3,6 @@ using System.Linq; using Nuke.Common; using Nuke.Common.CI; -using Nuke.Common.CI.GitHubActions; using Nuke.Common.Git; using Nuke.Common.IO; using Nuke.Common.ProjectModel; @@ -14,7 +13,7 @@ using Serilog; [ShutdownDotNetAfterServerBuild] -partial class Build : NukeBuild, ITest, IPack +partial class Build : NukeBuild, IPublish { public static int Main() => Execute(x => ((ICompile) x).Compile); @@ -31,6 +30,16 @@ partial class Build : NukeBuild, ITest, IPack [Parameter] string Version; + string PublicNuGetSource => "https://api.nuget.org/v3/index.json"; + string FeedzNuGetSource => "https://f.feedz.io/acornima/acornima/nuget/index.json"; + + [Parameter] [Secret] readonly string PublicNuGetApiKey; + [Parameter] [Secret] readonly string FeedzNuGetApiKey; + + bool IsPublicRelease => GitRepository.IsOnMainOrMasterBranch() && IsTaggedBuild; + string IPublish.NuGetSource => IsPublicRelease ? PublicNuGetSource : FeedzNuGetSource; + string IPublish.NuGetApiKey => IsPublicRelease ? PublicNuGetApiKey : FeedzNuGetApiKey; + protected override void OnBuildInitialized() { VersionSuffix = !IsTaggedBuild @@ -41,6 +50,13 @@ protected override void OnBuildInitialized() { VersionSuffix = $"dev-{DateTime.UtcNow:yyyyMMdd-HHmm}"; } + else + { + if (IsTaggedBuild) + { + Version = TagVersion; + } + } Log.Information("BUILD SETUP"); Log.Information("Configuration:\t{Configuration}", ((IHazConfiguration) this).Configuration); @@ -60,7 +76,16 @@ protected override void OnBuildInitialized() public IEnumerable TestProjects => ((IHazSolution) this).Solution.AllProjects.Where(x => x.Name.Contains("Tests")); - public Configure TestProjectSettings => (testSettings, _) => testSettings - .When(GitHubActions.Instance is not null, settings => settings.AddLoggers("GitHubActions;report-warnings=false")); + public Configure CompileSettings => _ => _ + .SetVersion(Version) + .SetVersionSuffix(VersionSuffix); + + public Configure PublishSettings => _ => _ + .SetVersion(Version) + .SetVersionSuffix(VersionSuffix); + + public Configure PackSettings => _ => _ + .SetVersion(Version) + .SetVersionSuffix(VersionSuffix); } diff --git a/test/Acornima.Tests.Test262/.config/dotnet-tools.json b/test/Acornima.Tests.Test262/.config/dotnet-tools.json index 0b0a8be..ff3edde 100644 --- a/test/Acornima.Tests.Test262/.config/dotnet-tools.json +++ b/test/Acornima.Tests.Test262/.config/dotnet-tools.json @@ -3,10 +3,10 @@ "isRoot": true, "tools": { "test262harness.console": { - "version": "0.0.22", + "version": "1.0.0", "commands": [ "test262" ] } } -} \ No newline at end of file +} diff --git a/test/Acornima.Tests.Test262/Acornima.Tests.Test262.csproj b/test/Acornima.Tests.Test262/Acornima.Tests.Test262.csproj index 0245419..6ca8fe3 100644 --- a/test/Acornima.Tests.Test262/Acornima.Tests.Test262.csproj +++ b/test/Acornima.Tests.Test262/Acornima.Tests.Test262.csproj @@ -12,7 +12,7 @@ - +