-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
send_raven.ps1
59 lines (46 loc) · 2.42 KB
/
send_raven.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
# variables
$id = "raven"
$name = "Raven Reader"
$accounts = "@helloefficiency @mrgodhani"
$tags = "#raven"
# extract latest version and release
$tag = (Invoke-WebRequest "https://api.github.com/repos/hello-efficiency-inc/raven-reader/releases/latest" -Headers $headers | ConvertFrom-Json)[0].name
$tag = $tag.Trim("v")
$release = (Invoke-WebRequest "https://api.github.com/repos/hello-efficiency-inc/raven-reader/releases/latest" -Headers $headers | ConvertFrom-Json)[0].body
# $regex = '([0-9]{3,})'
# $release = $release -replace $regex, '[${1}](https://github.com/hello-efficiency-inc/raven-reader/issues/${1})'
# write new version and release
$file = "./$id/$id.nuspec"
$xml = New-Object XML
$xml.Load($file)
$xml.package.metadata.version = $tag
$xml.package.metadata.releaseNotes = $release
$xml.Save($file)
# download installer and LICENSE
Invoke-WebRequest -Uri "https://github.com/hello-efficiency-inc/raven-reader/releases/download/v$tag/Raven-Reader-Setup-$tag.exe" -OutFile "./$id/tools/$id.exe"
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/hello-efficiency-inc/raven-reader/master/LICENSE" -OutFile "./$id/legal/LICENSE.txt"
# calculation of checksum
$TABLE = Get-FileHash "./$id/tools/$id.exe" -Algorithm SHA256
$SHA = $TABLE.Hash
# writing of VERIFICATION.txt
$content = "VERIFICATION
Verification is intended to assist the Chocolatey moderators and community
in verifying that this package's contents are trustworthy.
The installer have been downloaded from their official github repository listed on <https://github.com/hello-efficiency-inc/raven-reader/releases/>
and can be verified like this:
1. Download the following installer:
Version $tag : <https://github.com/hello-efficiency-inc/raven-reader/releases/download/v$tag/Raven-Reader-Setup-$tag.exe>
2. You can use one of the following methods to obtain the checksum
- Use powershell function 'Get-Filehash'
- Use chocolatey utility 'checksum.exe'
checksum type: SHA256
checksum: $SHA
File 'LICENSE.txt' is obtained from <https://raw.githubusercontent.com/hello-efficiency-inc/raven-reader/master/LICENSE> " | out-file -filepath "./$id/legal/VERIFICATION.txt"
# packaging
choco pack "./$id/$id.nuspec" --outputdirectory ".\$id"
If ($LastExitCode -eq 0) {
choco push "./$id/$id.$tag.nupkg" --source https://push.chocolatey.org/
./END.ps1
} else {
echo "Error in introduction - Exit code: $LastExitCode "
}