Skip to content

Commit d015bbe

Browse files
committed
Chocolatey package script generates checksum and populates verification file
1 parent 965a82a commit d015bbe

File tree

6 files changed

+50
-12
lines changed

6 files changed

+50
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ paket-files/
252252
*.sln.iml
253253

254254
# Install package directories
255+
install/chocolatey/*.zip
255256
install/chocolatey/git-diff-xlsx/tools
256257
install/deb/*.deb
257258
install/deb/git-diff-xlsx
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+

2+
VERIFICATION
3+
Verification is intended to assist the Chocolatey moderators and community
4+
in verifying that this package's contents are trustworthy.
5+
6+
This package is published by the git-diff-xlsx project itself and can be verified like this:
7+
8+
1. Download the following installers
9+
https://github.com/webbwebbwebb/git-diff-xlsx/releases/download/v[!!VERSION_NUMBER!!]/git-diff-xlsx.[!!VERSION_NUMBER!!].zip
10+
11+
2. You can use one of the following methods to obtain the checksum
12+
- Use powershell function 'Get-Filehash'
13+
- Use chocolatey utility 'checksum.exe'
14+
15+
checksum type: sha256
16+
checksum32: [!!CHECKSUM!!]
17+
18+
File 'LICENSE' is obtained from <https://github.com/webbwebbwebb/git-diff-xlsx/blob/master/LICENSE>
19+
20+
21+

install/chocolatey/git-diff-xlsx/VERIFICATION.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
$ErrorActionPreference = 'Stop';
2+
3+
$version_number = "$env:ChocolateyPackageVersion"
4+
$tools_dir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
5+
6+
Get-ChocolateyUnzip -FileFullPath "$tools_dir\git-diff-xlsx.$version_number.zip" -Destination $tools_dir

install/chocolatey/package.ps1

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,32 @@ if($package_information -match '(?<=git-diff-xlsx\/)(\d+\.)?(\d+\.)?(\d+)') {
1313
throw 'Cannot determine version number'
1414
}
1515

16+
Remove-Item "$script_dir\*.nupkg"
17+
Remove-Item "$script_dir\*.zip"
18+
1619
# Purge output directory
17-
remove-item "$output_dir" -recurse -force
20+
Remove-Item "$output_dir" -Recurse -Force
21+
New-Item "$output_dir" -Force -ItemType "directory"
22+
23+
# Archive contents of publish directory
24+
$release_zip_filename = "git-diff-xlsx.$version_number.zip"
25+
Compress-Archive "$source_dir\*" "$script_dir\$release_zip_filename"
26+
$checksum = (Get-FileHash "$script_dir\$release_zip_filename").Hash
27+
Copy-Item "$script_dir\$release_zip_filename" "$output_dir\$release_zip_filename"
28+
29+
# Generate verification file
30+
$verification_content = Get-Content -Path "$package_dir\VERIFICATION.template.txt" -Raw
31+
$verification_content = $verification_content.Replace("[!!VERSION_NUMBER!!]", $version_number).Replace("[!!CHECKSUM!!]", $checksum)
32+
Out-File -FilePath "$output_dir\VERIFICATION.txt" -InputObject $verification_content
1833

19-
# Copy contents of publish directory
20-
robocopy "$source_dir" "$output_dir" /MIR
2134
# Copy licence
2235
Copy-Item "$script_dir\..\..\LICENSE" "$output_dir\LICENSE.txt"
23-
Copy-Item "$package_dir\VERIFICATION.txt" "$output_dir\VERIFICATION.txt"
2436

25-
Remove-Item "$script_dir\*.nupkg"
37+
Copy-Item "$package_dir\chocolateyInstall.ps1" "$output_dir\chocolateyInstall.ps1"
2638

2739
# Create package
2840
choco pack --version $version_number git-diff-xlsx/git-diff-xlsx.nuspec
41+
42+
# Test install
43+
choco uninstall git-diff-xlsx --force
44+
choco install git-diff-xlsx -dv -source "'.;https://chocolatey.org/api/v2/'"

src/git-diff-xlsx/git-diff-xlsx.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<Company>Summerhouse Software Limited</Company>
1010
<Copyright>Copyright © Summerhouse Software 2016-2020</Copyright>
1111
<AssemblyVersion>1.0.0.0</AssemblyVersion>
12-
<Version>1.0.0</Version>
12+
<Version>1.0.1</Version>
1313
<ApplicationIcon>..\..\icon\diff-icon.ico</ApplicationIcon>
1414
</PropertyGroup>
1515

0 commit comments

Comments
 (0)