forked from xBimTeam/XbimEssentials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpatchXbim.ps1
74 lines (59 loc) · 3.01 KB
/
patchXbim.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using namespace System
$xmlsettings = New-Object System.Xml.XmlWriterSettings
$xmlsettings.Indent = $true
$xmlsettings.IndentChars = " "
$versionNumber = '5.2.11'
# function AddRepositoryUrl($path) {
# $propertyGroup = Select-Xml -Path $path -XPath '/Project/PropertyGroup[1]'
# if ($propertyGroup) {
# $doc = $propertyGroup.Node.OwnerDocument
# $urlNode = $doc.CreateNode("element", "RepositoryUrl", $null)
# $urlNode.InnerText = 'https://github.com/novorender/novorender-backend'
# $propertyGroup.node.AppendChild($urlNode)
# $version = $doc.CreateNode("element", "Version", $null)
# $version.InnerText = $versionNumber
# $propertyGroup.node.AppendChild($version)
# # Set the File Name Create The Document
# $XmlWriter = [System.XML.XmlWriter]::Create($path, $xmlsettings)
# $doc.Save($XmlWriter)
# $XmlWriter.Dispose()
# }
# }
# Get-ChildItem -Path .\ -Filter *.csproj -Recurse -File | ForEach-Object {
# ((Get-Content -path xbim.essentials.nuspec -Raw) -replace '5.2.9', $versionNumber) | Set-Content -Path xbim.essentials.nuspec
# AddRepositoryUrl($_.FullName)
# }
# $file = get-item -path 'nuget.config'
# $configuration = Select-Xml -Path $file -XPath '/configuration'
# $packageSources = $configuration.Node['packageSources']
# $packageSources.InnerXml = '<add key="github" value="https://nuget.pkg.github.com/novorender/index.json" />'
# $doc = $configuration.Node.OwnerDocument
# $packageSourceCredentials = $doc.CreateNode("element", "packageSourceCredentials", $null)
# $packageSourceCredentials.InnerXml = '<github><add key="Username" value="SigveBergslien" /><add key="ClearTextPassword" value="key" /></github>'
# $configuration.Node.AppendChild($packageSourceCredentials)
# #$writer = New-Object System.XMl.XmlTextWriter 'tmpfile.xml', $null
# #$writer.Formatting = “indented”
# #$writer.Indentation = 2
# ## Set The Formatting
# #$xmlsettings = New-Object System.Xml.XmlWriterSettings
# #$xmlsettings.Indent = $true
# #$xmlsettings.IndentChars = " "
# ## Set the File Name Create The Document
# #$writer = [System.XML.XmlWriter]::Create('tmp2file', $xmlsettings)
# $doc.Save($file.FullName)
# ((Get-Content -path xbim.essentials.nuspec -Raw) -replace '5.2.9', $versionNumber) | Set-Content -Path .\xbim.essentials.nuspec
nuget pack .\xbim.essentials.nuspec
dotnet pack --configuration Release
Get-ChildItem -Path .\ -Filter *$versionNumber.nupkg -Recurse -File | ForEach-Object {
dotnet nuget push $_.FullName --source "github" -k key
}
# $packetSources.Node.RemoveAll()
# $doc = $packetSources.Node.OwnerDocument
# $clearNode = $doc.CreateNode("element", "clear", $null)
# $packetSources.Node.AppendChild($clearNode)
# $githubUrl = $doc.CreateNode("element", "add", $null)
# $attr = $doc.CreateAttribute("key")
# $attr.Value = "github"
# $githubUrl.Attributes.Append("key", "github")
# $githubUrl.Attributes.Append("value", "https://nuget.pkg.github.com/NovoTechAS/index.json")
#$packetSources.Node.AppendChild($githubUrl)