Skip to content

Commit

Permalink
Use paket.template for generating the nupkg
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime Mangel committed Jun 7, 2019
1 parent 1f26983 commit 3c18568
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 13 deletions.
7 changes: 4 additions & 3 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ let root = __SOURCE_DIRECTORY__
module Source =
let dir = root </> "src"
let projectFile = dir </> "Thoth.Json.Net.fsproj"
let paketTemplate = dir </> "paket.template"

module Tests =
let dir = root </> "tests"
Expand Down Expand Up @@ -173,7 +174,7 @@ let needsPublishing (versionRegex: Regex) (newVersion: string) projFile =
not sameVersion

let pushNuget (newVersion: string) (projFile: string) =
let versionRegex = Regex("<Version>(.*?)</Version>", RegexOptions.IgnoreCase)
let versionRegex = Regex("version\\s(.*?)", RegexOptions.IgnoreCase)

let nugetKey =
match Environment.environVarOrNone "NUGET_KEY" with
Expand All @@ -183,7 +184,7 @@ let pushNuget (newVersion: string) (projFile: string) =
let needsPublishing = needsPublishing versionRegex newVersion projFile

(versionRegex, projFile) ||> Util.replaceLines (fun line _ ->
versionRegex.Replace(line, "<Version>" + newVersion + "</Version>") |> Some)
versionRegex.Replace(line, "version " + newVersion) |> Some)

Paket.pack (fun p ->
{ p with BuildConfig = "Release"
Expand Down Expand Up @@ -237,7 +238,7 @@ let getNotes (version : string) =

Target.create "Publish" (fun _ ->
let version = getLastVersion()
pushNuget version Source.projectFile
pushNuget version Source.paketTemplate
)

Target.create "Release" (fun _ ->
Expand Down
9 changes: 0 additions & 9 deletions src/Thoth.Json.Net.fsproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>Elm-inspired encoder and decoder for JSON targetting .Net and NetCore runtime</Description>
<PackageProjectUrl>https://github.com/thoth-org/Thoth.Json.Net</PackageProjectUrl>
<Packagelicense>https://github.com/thoth-org/Thoth.Json.Net/blob/master/LICENSE.md</Packagelicense>
<RepositoryUrl>https://github.com/thoth-org/Thoth.Json.Net</RepositoryUrl>
<PackageTags>fsharp;json</PackageTags>
<Authors>Maxime Mangel</Authors>
<Version>3.4.0</Version>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net46</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down
24 changes: 23 additions & 1 deletion src/paket.template
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
type project
type file

id Thoth.Json.Net
version 3.4.0
title Thoth.Json.Net
authors Maxime Mangel
description Elm-inspired encoder and decoder for JSON targetting .Net and NetCore runtime
licenseUrl https://github.com/thoth-org/Thoth.Json.Net/blob/master/LICENSE.md
projectUrl https://github.com/thoth-org/Thoth.Json.Net
tags fsharp,json

files
bin/Release/**/Thoth.Json.Net.dll ==> lib
bin/Release/**/Thoth.Json.Net.xml ==> lib

dependencies
framework: net46
FSharp.Core ~> LOCKEDVERSION
Newtonsoft.Json >= 11.0.2
framework: netstandard2.0
FSharp.Core ~> LOCKEDVERSION
Newtonsoft.Json >= 11.0.2
Fable.Core ~> LOCKEDVERSION

0 comments on commit 3c18568

Please sign in to comment.