|
1 | | -param($ver) |
| 1 | +param($version) |
2 | 2 |
|
3 | 3 | $ErrorActionPreference = 'Stop' |
4 | 4 |
|
5 | | -Remove-Item build -Recurse -Force -ErrorAction SilentlyContinue |
| 5 | +Remove-Item .\chocolatey\build -Recurse -Force -ErrorAction SilentlyContinue |
6 | 6 |
|
7 | | -New-Item ./build -Force -ItemType Directory |
8 | | -Copy-Item dokany.nuspec.template build/dokany.nuspec |
9 | | -Copy-Item tools build/ -Recurse |
10 | | -Rename-Item build/tools/chocolateyinstall.ps1.template chocolateyinstall.ps1 |
| 7 | +New-Item .\chocolatey\build -Force -ItemType Directory |
| 8 | +Copy-Item .\chocolatey\dokany.nuspec.template .\chocolatey\build\dokany.nuspec |
| 9 | +Copy-Item .\chocolatey\tools .\chocolatey\build\ -Recurse |
| 10 | +Rename-Item .\chocolatey\build\tools\chocolateyinstall.ps1.template chocolateyinstall.ps1 |
11 | 11 |
|
12 | | -(Get-Content build/dokany.nuspec).Replace('[[PackageVersion]]', $ver) | Set-Content build/dokany.nuspec |
13 | | - |
14 | | -$url64 = "https://github.com/dokan-dev/dokany/releases/download/v${ver}/Dokan_x64.msi" |
15 | | -$url32 = "https://github.com/dokan-dev/dokany/releases/download/v${ver}/Dokan_x86.msi" |
| 12 | +(Get-Content -Encoding UTF8 .\chocolatey\build\dokany.nuspec).Replace('[[PackageVersion]]', $version) | Set-Content -Encoding UTF8 .\chocolatey\build\dokany.nuspec |
16 | 13 |
|
17 | 14 | function Hash { |
18 | 15 | param ( |
19 | | - $url |
| 16 | + $path |
20 | 17 | ) |
21 | | - Invoke-WebRequest $url -OutFile build/dokany.msi |
22 | | - $hash = Get-FileHash build/dokany.msi -Algorithm SHA256 |
| 18 | + $hash = Get-FileHash $path -Algorithm SHA256 |
23 | 19 | # return hex string |
24 | 20 | return $hash.Hash |
25 | 21 | } |
26 | 22 |
|
27 | | -$hash64 = Hash $url64 |
28 | | -$hash32 = Hash $url32 |
| 23 | +$hash64 = Hash .\dokan_wix\Dokan_x64.msi |
| 24 | +$hash32 = Hash .\dokan_wix\Dokan_x86.msi |
29 | 25 |
|
30 | | -$install = (Get-Content build/tools/chocolateyinstall.ps1) |
| 26 | +$install = (Get-Content .\chocolatey\build\tools\chocolateyinstall.ps1) |
31 | 27 | $install = $install.Replace('[[Url]]', $url32).Replace('[[Checksum]]', $hash32) |
32 | 28 | $install = $install.Replace('[[Url64]]', $url64).Replace('[[Checksum64]]', $hash64) |
33 | | -Set-Content build/tools/chocolateyinstall.ps1 -Value $install |
| 29 | +Set-Content -Encoding UTF8 .\chocolatey\build\tools\chocolateyinstall.ps1 -Value $install |
34 | 30 |
|
35 | | -Set-Location .\build |
36 | | -choco pack |
37 | | -Set-Location .. |
| 31 | +choco pack .\chocolatey\build\dokany.nuspec --out .\chocolatey\build |
0 commit comments