From 03c92160262754fd92f7d1ebac9fb62ddbd82578 Mon Sep 17 00:00:00 2001 From: blotus Date: Thu, 20 Oct 2022 11:12:54 +0200 Subject: [PATCH] Update chocolatey spec file and publish nupkg in github releases (#1826) --- .gitignore | 2 +- azure-pipelines.yml | 19 ++++++++++++++++++- make_chocolatey.ps1 | 2 +- windows/Chocolatey/crowdsec/crowdsec.nuspec | 6 ++++-- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 0ccbb993d..b968a732b 100644 --- a/.gitignore +++ b/.gitignore @@ -38,5 +38,5 @@ crowdsec-v* pkg/cwhub/hubdir/.index.json msi *.msi -*.nukpg +**/*.nupkg *.tgz diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d863a009c..74ff97a8d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -47,7 +47,7 @@ stages: SecretsFilter: 'CodeSigningUser,CodeSigningPassword' RunAsPreJob: false - - task: DownloadSEcureFile@1 + - task: DownloadSecureFile@1 inputs: secureFile: appsettings.json @@ -68,6 +68,15 @@ stages: displayName: "Build Crowdsec MSI" 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: | SignClient.exe Sign --name "crowdsec-msi" ` --input "*.msi" --config (Join-Path -Path $(Agent.TempDirectory) -ChildPath "appsettings.json") ` @@ -80,6 +89,13 @@ stages: ArtifactName: 'crowdsec.msi' publishLocation: 'Container' 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 dependsOn: Build jobs: @@ -106,4 +122,5 @@ stages: #the .. is an ugly hack, but I can't find the var that gives D:\a\1 ... assets: | $(Build.ArtifactStagingDirectory)\..\crowdsec.msi/*.msi + $(Build.ArtifactStagingDirectory)\..\crowdsec.nupkg/*.nupkg condition: ne(variables['GetLatestPrelease.LatestPreRelease'], '') diff --git a/make_chocolatey.ps1 b/make_chocolatey.ps1 index b09029926..67f85c33d 100644 --- a/make_chocolatey.ps1 +++ b/make_chocolatey.ps1 @@ -15,4 +15,4 @@ if ($version.Contains("-")) Set-Location .\windows\Chocolatey\crowdsec Copy-Item ..\..\..\crowdsec_$version.msi tools\crowdsec.msi -choco pack \ No newline at end of file +choco pack --version $version \ No newline at end of file diff --git a/windows/Chocolatey/crowdsec/crowdsec.nuspec b/windows/Chocolatey/crowdsec/crowdsec.nuspec index bcde3278b..459438d24 100644 --- a/windows/Chocolatey/crowdsec/crowdsec.nuspec +++ b/windows/Chocolatey/crowdsec/crowdsec.nuspec @@ -3,7 +3,8 @@ crowdsec - 1.3.3 + + 0.0.1 https://github.com/crowdsecurity/crowdsec CrowdSecurity @@ -13,11 +14,12 @@ CrowdSecurity https://crowdsec.net/ CrowdSec, 2022 - https://github.com/crowdsecurity/crowdsec/blob/main/LICENSE + https://github.com/crowdsecurity/crowdsec/blob/master/LICENSE true https://github.com/crowdsecurity/crowdsec https://docs.crowdsec.net https://github.com/crowdsecurity/crowdsec/issues + https://cdn.jsdelivr.net/gh/crowdsecurity/crowdsec-docs@c7b90095cca0007652f22c5c6d945c3416df4693/crowdsec-docs/static/img/crowdsec_no_txt.png crowdsec crowdsecurity security ips ids CrowdSec IDS