You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.2 KiB

open System.Xml
open System.IO
let replaceXPathInnerText xpath innerTextValue (doc: XmlDocument) =
let node = doc.SelectSingleNode xpath
if isNull node then
failwithf "XML node '%s' not found" xpath
node.InnerText <- innerTextValue
let private load (fileName: string) (doc: XmlDocument) =
use fs = File.OpenRead(fileName)
doc.Load fs
let loadDoc (path: string) =
let xmlDocument = new XmlDocument()
load path xmlDocument
let saveDoc (fileName: string) (doc: XmlDocument) =
use fs = File.Open(fileName, FileMode.Truncate, FileAccess.Write)
doc.Save fs
let pokeInnerText (fileName: string) xpath innerTextValue =
let doc = new XmlDocument()
load fileName doc
replaceXPathInnerText xpath innerTextValue doc
|> saveDoc fileName
let changelog = File.ReadLines("./")
let releaseVersion =
let latestVersion =
|> Seq.find (fun c -> c.StartsWith("###"))
let entryProject = "./src/Fable.Etebase.fsproj"
pokeInnerText entryProject "/Project/PropertyGroup[1]/Version[1]" releaseVersion
saveDoc entryProject (loadDoc entryProject)
printfn "%s" releaseVersion