-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.ps1
67 lines (56 loc) · 1.25 KB
/
scripts.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
param([String]$version)
If (!$version)
{
echo "version is required"
exit
}
echo "Version = $version"
$artifactsPath = '.artifacts'
$binPath = "$artifactsPath\bin"
$publishPath = "$artifactsPath\publish"
$paket = ".paket\paket"
Function Restore()
{
& $paket restore
}
Function Clean()
{
If(test-path $artifactsPath)
{
Remove-Item -Path $artifactsPath -Force -Recurse
}
}
Function DownloadBinary($version)
{
If(!(test-path $binPath))
{
New-Item -ItemType Directory -Path $binPath -Force
}
Invoke-WebRequest -OutFile $binPath\swagger-codegen-cli.jar http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/$version/swagger-codegen-cli-$version.jar
}
Function Pack($version)
{
echo 'Packing...'
& $paket pack $publishPath --template paket.template --specific-version Steinpilz.SwaggerCodeGenTool $version
echo 'Packed.'
}
Function Publish($version)
{
echo 'Publishing...'
& $paket push $publishPath\Steinpilz.SwaggerCodeGenTool.$version.nupkg --api-key $env:NUGET_API_KEY
echo 'Published'
}
Clean
Restore
DownloadBinary($version)
$cmd = $args[0]
echo "Calling $cmd"
If ($cmd -eq 'pack')
{
Pack($version)
}
if ($cmd -eq 'publish')
{
Pack($version)
Publish($version)
}