From: js6pak Date: Sun, 18 Dec 2022 18:43:40 +0000 (+0100) Subject: Add CI X-Git-Tag: 1.0.0^2~1 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=41ce4a6409fe0d67afb3ee65f35142997af0833a;p=rhonda%2Fimpostor.hazel.git Add CI --- diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..3593f34 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,32 @@ +name: CI + +on: [ "push", "pull_request" ] + +jobs: + build: + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v3 + with: + submodules: true + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 7.x + + - name: Run the Cake script + uses: cake-build/cake-action@94fa55b4f83cee90f2621654eba6a056ae71df90 + with: + verbosity: Diagnostic + + - uses: actions/upload-artifact@v3 + with: + name: nuget packages + path: ./*/bin/Release*/*.nupkg + + - name: Push NuGet package + if: github.ref_type == 'tag' + run: | + dotnet nuget push ./{Hazel,Impostor.Hazel.Abstractions}/bin/Release/*.nupkg --source ${{ secrets.NUGET_SOURCE }} --api-key ${{ secrets.NUGET_KEY }} diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..3c32f7e --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,11 @@ + + + Impostor + MIT + https://github.com/Impostor/Impostor.Hazel + git + + 1.0.0 + dev + + \ No newline at end of file diff --git a/Hazel/Hazel.csproj b/Hazel/Hazel.csproj index e3f1726..021ad27 100644 --- a/Hazel/Hazel.csproj +++ b/Hazel/Hazel.csproj @@ -6,6 +6,7 @@ HAZEL_BAG Impostor.Hazel Impostor.Hazel + true diff --git a/Impostor.Hazel.Abstractions/Impostor.Hazel.Abstractions.csproj b/Impostor.Hazel.Abstractions/Impostor.Hazel.Abstractions.csproj index 6836c68..6d30606 100644 --- a/Impostor.Hazel.Abstractions/Impostor.Hazel.Abstractions.csproj +++ b/Impostor.Hazel.Abstractions/Impostor.Hazel.Abstractions.csproj @@ -4,6 +4,7 @@ net7.0 enable enable + true diff --git a/build.cake b/build.cake new file mode 100644 index 0000000..bfac352 --- /dev/null +++ b/build.cake @@ -0,0 +1,28 @@ +var target = Argument("target", "Build"); + +var workflow = BuildSystem.GitHubActions.Environment.Workflow; +var buildId = workflow.RunNumber; +var tag = workflow.RefType == GitHubActionsRefType.Tag ? workflow.RefName : null; + +Task("Build") + .Does(() => +{ + var settings = new DotNetBuildSettings + { + Configuration = "Release", + MSBuildSettings = new DotNetMSBuildSettings(), + }; + + if (tag != null) + { + settings.MSBuildSettings.Version = tag; + } + else if (buildId != 0) + { + settings.MSBuildSettings.VersionSuffix = "ci." + buildId; + } + + DotNetBuild(".", settings); +}); + +RunTarget(target);