-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
send_tenacity.ps1
72 lines (57 loc) · 2.58 KB
/
send_tenacity.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
# variables
$id = "tenacity"
$name = "Tenacity"
$accounts = "@TenacityAudio"
$tags = "#tenacity"
# extract latest version and release
$json = (Invoke-WebRequest "https://codeberg.org/api/v1/repos/tenacityteam/tenacity/releases" | ConvertFrom-Json)[0]
$tag = $json.tag_name
$tag = $tag.Trim("v")
if ($tag -match '^[0-9]+.[0-9]+$'){
$tag = $tag + ".0"
}
$release = $json.body
# 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
#$urltag = "v" + $tag
#$urltag = $urltag -replace "-beta",".0"
$url64 = ($json.assets | where { $_.name -eq "tenacity-win-$tag-x64.exe" }).browser_download_url
$url32 = ($json.assets | where { $_.name -eq "tenacity-win-$tag-x86.exe" }).browser_download_url
Invoke-WebRequest -Uri $url64 -OutFile ".\$id\tools\tenacity64.exe"
Invoke-WebRequest -Uri $url32 -OutFile ".\$id\tools\tenacity32.exe"
Invoke-WebRequest -Uri "https://codeberg.org/tenacityteam/tenacity/raw/branch/main/LICENSE.txt" -OutFile "./$id/legal/LICENSE.txt"
# calculation of checksum
$TABLE64 = Get-FileHash "./$id/tools/tenacity64.exe" -Algorithm SHA256
$SHA64 = $TABLE64.Hash
$TABLE32 = Get-FileHash "./$id/tools/tenacity32.exe" -Algorithm SHA256
$SHA32 = $TABLE32.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://codeberg.org/tenacityteam/tenacity/releases>
and can be verified like this:
1. Download the following installer:
Version $tag 64 bits : <https://codeberg.org/tenacityteam/tenacity/releases/tag/v$tag>
Version $tag 32 bits : <https://codeberg.org/tenacityteam/tenacity/releases/tag/v$tag>
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 64 bits: $SHA64
checksum 32 bits: $SHA32
File 'LICENSE.txt' is obtained from <https://codeberg.org/tenacityteam/tenacity/raw/branch/main/LICENSE.txt> " | 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 "
}