From bb6bb1704dde686c44f256be2139f7c26d43fa67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sun, 12 May 2024 11:33:06 +0200 Subject: [PATCH] use git describe --tags instead dotnet tool for get an version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan-Otto Kröpke --- .github/workflows/release.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 38ebae20d..cdbff5a04 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,7 +41,6 @@ jobs: - name: Install Build deps run: | - dotnet tool install --global GitVersion.Tool --version 5.* Invoke-WebRequest -Uri https://github.com/prometheus/promu/releases/download/v$($Env:PROMU_VER)/promu-$($Env:PROMU_VER).windows-amd64.zip -OutFile promu-$($Env:PROMU_VER).windows-amd64.zip Expand-Archive -Path promu-$($Env:PROMU_VER).windows-amd64.zip -DestinationPath . Copy-Item -Path promu-$($Env:PROMU_VER).windows-amd64\promu.exe -Destination "$(go env GOPATH)\bin" @@ -53,16 +52,14 @@ jobs: run: | $ErrorActionPreference = "Stop" - dotnet-gitversion /output json /showvariable FullSemVer | Set-Content VERSION -PassThru - + $Version = git describe --tag + $Version = $Version -replace 'v', '' # '+' symbols are invalid characters in image tags - (Get-Content -Path VERSION) -replace '\+', '_' | Set-Content -Path VERSION - - $Version = Get-Content VERSION - - make crossbuild + $Version = $Version -replace '\+', '_' + $Version | Set-Content VERSION -PassThru make build-all + # GH requires all files to have different names, so add version/arch to differentiate foreach($Arch in "amd64", "arm64") { Move-Item output\$Arch\windows_exporter.exe output\windows_exporter-$Version-$Arch.exe @@ -79,11 +76,11 @@ jobs: - name: Build Release Artifacts run: | $ErrorActionPreference = "Stop" - $BuildVersion = Get-Content VERSION + $Version = Get-Content VERSION foreach($Arch in "amd64", "arm64") { - Write-Host "Building windows_exporter $BuildVersion msi for $Arch" - .\installer\build.ps1 -PathToExecutable .\output\windows_exporter-$BuildVersion-$Arch.exe -Version $BuildVersion -Arch "$Arch" + Write-Host "Building windows_exporter $Version msi for $Arch" + .\installer\build.ps1 -PathToExecutable .\output\windows_exporter-$Version-$Arch.exe -Version $Version -Arch "$Arch" } Move-Item installer\*.msi output\