Update chocolatey spec file and publish nupkg in github releases (#1826)

This commit is contained in:
blotus 2022-10-20 11:12:54 +02:00 committed by GitHub
parent bb2f0e938f
commit 03c9216026
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 5 deletions

2
.gitignore vendored
View file

@ -38,5 +38,5 @@ crowdsec-v*
pkg/cwhub/hubdir/.index.json pkg/cwhub/hubdir/.index.json
msi msi
*.msi *.msi
*.nukpg **/*.nupkg
*.tgz *.tgz

View file

@ -47,7 +47,7 @@ stages:
SecretsFilter: 'CodeSigningUser,CodeSigningPassword' SecretsFilter: 'CodeSigningUser,CodeSigningPassword'
RunAsPreJob: false RunAsPreJob: false
- task: DownloadSEcureFile@1 - task: DownloadSecureFile@1
inputs: inputs:
secureFile: appsettings.json secureFile: appsettings.json
@ -68,6 +68,15 @@ stages:
displayName: "Build Crowdsec MSI" displayName: "Build Crowdsec MSI"
name: BuildMSI name: BuildMSI
- pwsh: |
$build_version=(git describe --tags (git rev-list --tags --max-count=1)).Substring(1)
if ($build_version.Contains("-"))
{
$build_version = $build_version.Substring(0, $build_version.IndexOf("-"))
}
.\make_chocolatey.ps1 -version $build_version
displayName: "Build Chocolatey nupkg"
- pwsh: | - pwsh: |
SignClient.exe Sign --name "crowdsec-msi" ` SignClient.exe Sign --name "crowdsec-msi" `
--input "*.msi" --config (Join-Path -Path $(Agent.TempDirectory) -ChildPath "appsettings.json") ` --input "*.msi" --config (Join-Path -Path $(Agent.TempDirectory) -ChildPath "appsettings.json") `
@ -80,6 +89,13 @@ stages:
ArtifactName: 'crowdsec.msi' ArtifactName: 'crowdsec.msi'
publishLocation: 'Container' publishLocation: 'Container'
displayName: "Upload MSI artifact" displayName: "Upload MSI artifact"
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.Repository.LocalPath)\\windows\\Chocolatey\\crowdsec\\crowdsec.$(BuildMSI.BuildVersion).nupkg'
ArtifactName: 'crowdsec.nupkg'
publishLocation: 'Container'
displayName: "Upload nupkg artifact"
- stage: Publish - stage: Publish
dependsOn: Build dependsOn: Build
jobs: jobs:
@ -106,4 +122,5 @@ stages:
#the .. is an ugly hack, but I can't find the var that gives D:\a\1 ... #the .. is an ugly hack, but I can't find the var that gives D:\a\1 ...
assets: | assets: |
$(Build.ArtifactStagingDirectory)\..\crowdsec.msi/*.msi $(Build.ArtifactStagingDirectory)\..\crowdsec.msi/*.msi
$(Build.ArtifactStagingDirectory)\..\crowdsec.nupkg/*.nupkg
condition: ne(variables['GetLatestPrelease.LatestPreRelease'], '') condition: ne(variables['GetLatestPrelease.LatestPreRelease'], '')

View file

@ -15,4 +15,4 @@ if ($version.Contains("-"))
Set-Location .\windows\Chocolatey\crowdsec Set-Location .\windows\Chocolatey\crowdsec
Copy-Item ..\..\..\crowdsec_$version.msi tools\crowdsec.msi Copy-Item ..\..\..\crowdsec_$version.msi tools\crowdsec.msi
choco pack choco pack --version $version

View file

@ -3,7 +3,8 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata> <metadata>
<id>crowdsec</id> <id>crowdsec</id>
<version>1.3.3</version> <!-- The version is set by the version argument of choco pack, so we just specify a dummy version here -->
<version>0.0.1</version>
<packageSourceUrl>https://github.com/crowdsecurity/crowdsec</packageSourceUrl> <packageSourceUrl>https://github.com/crowdsecurity/crowdsec</packageSourceUrl>
<owners>CrowdSecurity</owners> <owners>CrowdSecurity</owners>
<!-- ============================== --> <!-- ============================== -->
@ -13,11 +14,12 @@
<authors>CrowdSecurity</authors> <authors>CrowdSecurity</authors>
<projectUrl>https://crowdsec.net/</projectUrl> <projectUrl>https://crowdsec.net/</projectUrl>
<copyright>CrowdSec, 2022</copyright> <copyright>CrowdSec, 2022</copyright>
<licenseUrl>https://github.com/crowdsecurity/crowdsec/blob/main/LICENSE</licenseUrl> <licenseUrl>https://github.com/crowdsecurity/crowdsec/blob/master/LICENSE</licenseUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance> <requireLicenseAcceptance>true</requireLicenseAcceptance>
<projectSourceUrl>https://github.com/crowdsecurity/crowdsec</projectSourceUrl> <projectSourceUrl>https://github.com/crowdsecurity/crowdsec</projectSourceUrl>
<docsUrl>https://docs.crowdsec.net</docsUrl> <docsUrl>https://docs.crowdsec.net</docsUrl>
<bugTrackerUrl>https://github.com/crowdsecurity/crowdsec/issues</bugTrackerUrl> <bugTrackerUrl>https://github.com/crowdsecurity/crowdsec/issues</bugTrackerUrl>
<iconUrl>https://cdn.jsdelivr.net/gh/crowdsecurity/crowdsec-docs@c7b90095cca0007652f22c5c6d945c3416df4693/crowdsec-docs/static/img/crowdsec_no_txt.png</iconUrl>
<tags>crowdsec crowdsecurity security ips ids</tags> <tags>crowdsec crowdsecurity security ips ids</tags>
<summary>CrowdSec IDS</summary> <summary>CrowdSec IDS</summary>
<description> <description>