diff --git a/BuildScripts/InjectGitVersion.ps1 b/BuildScripts/InjectGitVersion.ps1 index 97a6a9b..16b4673 100644 --- a/BuildScripts/InjectGitVersion.ps1 +++ b/BuildScripts/InjectGitVersion.ps1 @@ -3,16 +3,27 @@ param ( ) $PSDefaultParameterValues = @{ '*:Encoding' = 'utf8' } -$productVersion = "1.4."; +$productVersion = "1.5."; $revision = "0"; $fileNames = Get-ChildItem -Path (Split-Path -Parent $PSScriptRoot) -Recurse -Include *.template $gitVersion = git describe --all --long --always --first-parent; -$gitVersion -match '.*/([\w\d]+)-(\d+)-[g](\w+)$'; +$match = $gitVersion -match '.*/([\w\d-]+)-(\d+)-[g](\w+)$'; +if ( -not $match ){ + Write-Host ( "Can not determine git version: {0}" -f $gitVersion ); + exit 1; +} + $gitTag = $Matches[1]; $gitSHA1 = $Matches[3]; +$fileVersion = $productVersion + $Version + "." + $revision; +$InfoVersion = $productVersion + $Version + "." + $revision + "-" + $gitTag + "-" + $gitSHA1; + +Write-Host "File Version: " + $fileVersion; +Write-Host "Info Version: " + $InfoVersion; + foreach ($fileName in $fileNames) { # Define file variables $file = Get-Item $fileName; @@ -30,3 +41,4 @@ foreach ($fileName in $fileNames) { } } + diff --git a/CodeBeautifier-VSPackage/source.extension.vsixmanifest b/CodeBeautifier-VSPackage/source.extension.vsixmanifest index a569275..87fa273 100644 --- a/CodeBeautifier-VSPackage/source.extension.vsixmanifest +++ b/CodeBeautifier-VSPackage/source.extension.vsixmanifest @@ -1,7 +1,7 @@  - + CodeBeautifier Code beautifier front end Add-in for Visual Studio evironment. Allows to use of any external code format application. http://www.manobit.com/code-beautifier-for-visual-studio/ @@ -13,9 +13,9 @@ beautifier, clang, code, code formatting, format, formatting, indentation, uncrustify, Visual Studo - - amd64 - + + + @@ -24,6 +24,6 @@ - + diff --git a/CodeBeautifier-VSPackage/source.extension.vsixmanifest.template b/CodeBeautifier-VSPackage/source.extension.vsixmanifest.template index 42c1966..1c14513 100644 --- a/CodeBeautifier-VSPackage/source.extension.vsixmanifest.template +++ b/CodeBeautifier-VSPackage/source.extension.vsixmanifest.template @@ -13,9 +13,9 @@ beautifier, clang, code, code formatting, format, formatting, indentation, uncrustify, Visual Studo - - amd64 - + + + @@ -24,6 +24,6 @@ - + diff --git a/Jenkinsfile b/Jenkinsfile index d0f424d..b63475a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,12 +11,18 @@ pipeline options { skipDefaultCheckout true } + environment { + GITHUB_TOKEN = credentials('marianob85-github-jenkins') + } stages { stage('Build'){ agent{ label "windows/buildtools2019" } steps { checkout scm + script { + env.GITHUB_REPO = sh(script: 'basename $(git remote get-url origin) .git', returnStdout: true).trim() + } powershell './BuildScripts/InjectGitVersion.ps1 -Version $env:BUILD_NUMBER' bat ''' call "C:/BuildTools/VC/Auxiliary/Build/vcvars64.bat" @@ -29,6 +35,7 @@ pipeline } } stage('UnitTests'){ + agent{ label "windows/buildtools2019" } steps { unstash "unitTest" powershell ''' @@ -38,6 +45,7 @@ pipeline } } stage('Compile check'){ + agent any steps { unstash "warningsFiles" script { @@ -48,11 +56,36 @@ pipeline } stage('Archive'){ + agent any steps { unstash "bin" archiveArtifacts artifacts: 'Installers/*, CodeBeautifier-VSPackage/out/Release/*.vsix', onlyIfSuccessful: true } } + + stage('Release') { + when { + buildingTag() + } + agent{ label "linux/u18.04/go:1.17.3" } + steps { + unstash 'bin' + sh ''' + go install github.com/github-release/github-release@v0.10.0 + github-release release --user marianob85 --repo ${GITHUB_REPO} --tag ${TAG_NAME} --name ${TAG_NAME} + for filename in CodeBeautifier-VSPackage/out/Release/*.vsix; do + [ -e "$filename" ] || continue + basefilename=$(basename "$filename") + github-release upload --user marianob85 --repo ${GITHUB_REPO} --tag ${TAG_NAME} --name ${basefilename} --file ${filename} + done + for filename in Installers/*.zip; do + [ -e "$filename" ] || continue + basefilename=$(basename "$filename") + github-release upload --user marianob85 --repo ${GITHUB_REPO} --tag ${TAG_NAME} --name ${basefilename} --file ${filename} + done + ''' + } + } } post { changed {