diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a5f4f2c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,25 @@ +name: Upload to nuget + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Pull submodules + run: git submodule update --init --recursive --depth 1 + - name: Setup .NET Core SDK $ + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 5.0.x + - name: Restore tools + run: dotnet tool restore + - name: Fake Build Script + run: dotnet fake build -t release + env: + NUGET_API_KEY: ${{secrets.NUGET_API_TOKEN}} + VERSION: ${{github.event.release.tag_name}} diff --git a/build.fsx b/build.fsx index 2302aff..06bbdfc 100644 --- a/build.fsx +++ b/build.fsx @@ -14,6 +14,8 @@ open Fake.IO open Fake.IO.Globbing.Operators open Fake.DotNet +let version = Environment.environVarOrDefault "VERSION" "0.0.1" +let nugetKey = Environment.environVarOrDefault "NUGET_API_KEY" "" let v0 = "src/AuthZedClient.V0/AuthZedClient.V0.csproj" @@ -51,7 +53,7 @@ let makePackOptions template (opt : Paket.PaketPackParams) = { opt with ToolType = ToolType.CreateLocalTool () TemplateFile = template - Version = "0.0.1" + Version = version OutputPath = packageDir LockDependencies = true } @@ -66,6 +68,17 @@ Target.create "PackV1" (fun _ -> Paket.pack (makePackOptions "src/AuthZedClient.V1/paket.template") ) +let makePushOptions (opt: Paket.PaketPushParams) = + { opt with + ToolType = ToolType.CreateLocalTool () + ApiKey = nugetKey + WorkingDir = packageDir + } + +Target.create "Release" (fun _ -> + Paket.push makePushOptions + ) + Target.create "Pack" ignore Target.create "Build" ignore @@ -79,7 +92,6 @@ Target.create "Build" ignore "PackV0" ==> "Pack" "PackV1" ==> "Pack" - - +"Clean" ==> "Pack" ==> "Release" Target.runOrDefault "BuildV1" diff --git a/src/AuthZedClient.V0/paket.template b/src/AuthZedClient.V0/paket.template index d4fb9ff..915a528 100644 --- a/src/AuthZedClient.V0/paket.template +++ b/src/AuthZedClient.V0/paket.template @@ -1,8 +1,10 @@ id AuthZedClient.V0 +title AuthZedClient.V0 type project authors Andrew McGuier description A client library for AuthZed generated from the grpc signatures licenseExpression Apache-2.0 +licenseUrl https://licenses.nuget.org/Apache-2.0 projectUrl https://github.com/amcguier/authzed-dotnet repositoryUrl https://github.com/amcguier/authzed-dotnet repositoryBranch main diff --git a/src/AuthZedClient.V1/paket.template b/src/AuthZedClient.V1/paket.template index 61bcd4e..cf5847c 100644 --- a/src/AuthZedClient.V1/paket.template +++ b/src/AuthZedClient.V1/paket.template @@ -1,8 +1,10 @@ id AuthZedClient.V1 +title AuthZedClient.V1 type project authors Andrew McGuier description A client library for AuthZed generated from the grpc signatures licenseExpression Apache-2.0 +licenseUrl https://licenses.nuget.org/Apache-2.0 projectUrl https://github.com/amcguier/authzed-dotnet repositoryUrl https://github.com/amcguier/authzed-dotnet repositoryBranch main