diff --git a/azure-pipelines-templates/build-chibios-stm32.yml b/azure-pipelines-templates/build-chibios-stm32.yml index 2d8cb77997..bb81e734b7 100644 --- a/azure-pipelines-templates/build-chibios-stm32.yml +++ b/azure-pipelines-templates/build-chibios-stm32.yml @@ -8,14 +8,14 @@ steps: - task: CMake@1 inputs: - cmakeArgs: '-G Ninja -DCMAKE_TOOLCHAIN_FILE=CMake/toolchain.arm-none-eabi.cmake -DTOOLCHAIN_PREFIX=$(GNU_GCC_TOOLCHAIN_PATH) -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_VERSION=$(NBGV_Version).$(NBGV_VersionHeight) -DCHIBIOS_BOARD=$(BoardName) $(BuildOptions) -DTOOL_HEX2DFU_PREFIX=$(HEX2DFU_PATH) ..' + cmakeArgs: '-G Ninja -DCMAKE_TOOLCHAIN_FILE=CMake/toolchain.arm-none-eabi.cmake -DTOOLCHAIN_PREFIX=$(GNU_GCC_TOOLCHAIN_PATH) -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_VERSION=$(NBGV_Version) -DCHIBIOS_BOARD=$(BoardName) $(BuildOptions) -DTOOL_HEX2DFU_PREFIX=$(HEX2DFU_PATH) ..' workingDirectory: ${{ parameters.buildDirectory }} displayName: Setup build with CMake and DFU condition: eq(variables['NeedsDFU'], true) - task: CMake@1 inputs: - cmakeArgs: '-G Ninja -DCMAKE_TOOLCHAIN_FILE=CMake/toolchain.arm-none-eabi.cmake -DTOOLCHAIN_PREFIX=$(GNU_GCC_TOOLCHAIN_PATH) -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_VERSION=$(NBGV_Version).$(NBGV_VersionHeight) -DCHIBIOS_BOARD=$(BoardName) $(BuildOptions) ..' + cmakeArgs: '-G Ninja -DCMAKE_TOOLCHAIN_FILE=CMake/toolchain.arm-none-eabi.cmake -DTOOLCHAIN_PREFIX=$(GNU_GCC_TOOLCHAIN_PATH) -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_VERSION=$(NBGV_Version) -DCHIBIOS_BOARD=$(BoardName) $(BuildOptions) ..' workingDirectory: ${{ parameters.buildDirectory }} displayName: Setup build with CMake without DFU condition: eq(variables['NeedsDFU'], false) diff --git a/azure-pipelines-templates/build-esp32.yml b/azure-pipelines-templates/build-esp32.yml index 93fd0191b3..af9ca47cc2 100644 --- a/azure-pipelines-templates/build-esp32.yml +++ b/azure-pipelines-templates/build-esp32.yml @@ -7,7 +7,7 @@ parameters: steps: - task: CMake@1 inputs: - cmakeArgs: '-G Ninja -DCMAKE_TOOLCHAIN_FILE=CMake/toolchain.xtensa-esp32-elf.cmake -DTOOLCHAIN_PREFIX=$(ESP32_TOOLCHAIN_PATH) -DESP32_IDF_PATH=$(ESP32_IDF_PATH) -DESP32_LIBS_PATH=$(ESP32_LIBS_PATH) -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_VERSION=$(NBGV_Version).$(NBGV_VersionHeight) -DESP32_BOARD=$(BoardName) $(BuildOptions) ..' + cmakeArgs: '-G Ninja -DCMAKE_TOOLCHAIN_FILE=CMake/toolchain.xtensa-esp32-elf.cmake -DTOOLCHAIN_PREFIX=$(ESP32_TOOLCHAIN_PATH) -DESP32_IDF_PATH=$(ESP32_IDF_PATH) -DESP32_LIBS_PATH=$(ESP32_LIBS_PATH) -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_VERSION=$(NBGV_Version) -DESP32_BOARD=$(BoardName) $(BuildOptions) ..' workingDirectory: ${{ parameters.buildDirectory }} displayName: Setup build with CMake diff --git a/azure-pipelines-templates/build-freertos-nxp.yml b/azure-pipelines-templates/build-freertos-nxp.yml index e43e9a8989..efe84d19c6 100644 --- a/azure-pipelines-templates/build-freertos-nxp.yml +++ b/azure-pipelines-templates/build-freertos-nxp.yml @@ -8,7 +8,7 @@ steps: - task: CMake@1 inputs: - cmakeArgs: '-G Ninja -DCMAKE_TOOLCHAIN_FILE=CMake/toolchain.arm-none-eabi.cmake -DTOOLCHAIN_PREFIX=$(GNU_GCC_TOOLCHAIN_PATH) -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_VERSION=$(NBGV_Version).$(NBGV_VersionHeight) -DFREERTOS_BOARD=$(BoardName) $(BuildOptions) -DTOOL_SRECORD_PREFIX=$(SRECORD_PATH)/srecord/ ..' + cmakeArgs: '-G Ninja -DCMAKE_TOOLCHAIN_FILE=CMake/toolchain.arm-none-eabi.cmake -DTOOLCHAIN_PREFIX=$(GNU_GCC_TOOLCHAIN_PATH) -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_VERSION=$(NBGV_Version) -DFREERTOS_BOARD=$(BoardName) $(BuildOptions) -DTOOL_SRECORD_PREFIX=$(SRECORD_PATH)/srecord/ ..' workingDirectory: ${{ parameters.buildDirectory }} displayName: Setup build with CMake diff --git a/azure-pipelines-templates/build-ti-simplelink.yml b/azure-pipelines-templates/build-ti-simplelink.yml index 7f90f49053..1caf3d3b6b 100644 --- a/azure-pipelines-templates/build-ti-simplelink.yml +++ b/azure-pipelines-templates/build-ti-simplelink.yml @@ -8,7 +8,7 @@ steps: - task: CMake@1 inputs: - cmakeArgs: '-G Ninja -DCMAKE_TOOLCHAIN_FILE=CMake/toolchain.arm-none-eabi.cmake -DTOOLCHAIN_PREFIX=$(GNU_GCC_TOOLCHAIN_PATH) -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_VERSION=$(NBGV_Version).$(NBGV_VersionHeight) -DTI_BOARD=$(BoardName) $(BuildOptions) ..' + cmakeArgs: '-G Ninja -DCMAKE_TOOLCHAIN_FILE=CMake/toolchain.arm-none-eabi.cmake -DTOOLCHAIN_PREFIX=$(GNU_GCC_TOOLCHAIN_PATH) -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_VERSION=$(NBGV_Version) -DTI_BOARD=$(BoardName) $(BuildOptions) ..' workingDirectory: ${{ parameters.buildDirectory }} displayName: Setup build with CMake diff --git a/azure-pipelines-templates/pack-publish-artifacts.yml b/azure-pipelines-templates/pack-publish-artifacts.yml index 065b214959..4f251b8552 100644 --- a/azure-pipelines-templates/pack-publish-artifacts.yml +++ b/azure-pipelines-templates/pack-publish-artifacts.yml @@ -17,11 +17,3 @@ steps: flattenFolders: true condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') ) displayName: Collecting deployable artifacts - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)\$(BoardName)' - ArtifactName: $(BoardName) - ArtifactType: Container - condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') ) - displayName: Publish deployables artifacts diff --git a/azure-pipelines-templates/publish-bintray.yml b/azure-pipelines-templates/publish-bintray.yml index 9f37af90b2..32af281e87 100644 --- a/azure-pipelines-templates/publish-bintray.yml +++ b/azure-pipelines-templates/publish-bintray.yml @@ -10,13 +10,53 @@ steps: rootFolderOrFile: '$(Build.ArtifactStagingDirectory)\$(BoardName)' includeRootFolder: false archiveType: 'zip' - archiveFile: '$(Agent.TempDirectory)\$(BoardName)-$(NBGV_SimpleVersion)$(NBGV_PrereleaseVersion).zip' + archiveFile: '$(Agent.TempDirectory)\$(BoardName)-$(NBGV_AssemblyVersion).zip' + replaceExistingArchive: true + # skip task on PR build and when on branch other than master or nf community targets + # execute on 'ForceUpload' parameter + condition: or( eq(variables['ForceUpload'], true), and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), or( eq(variables['Build.SourceBranchName'], 'master'), eq(variables['Build.Repository_Name'], 'nf-Community-Targets')) ) ) + displayName: Zip binary files + + - task: CopyFiles@1 + inputs: + sourceFolder: $(Agent.TempDirectory) + Contents: | + '$(Agent.TempDirectory)\$(BoardName)-$(NBGV_AssemblyVersion).zip' + TargetFolder: '$(Build.ArtifactStagingDirectory)\$(BoardName)' + flattenFolders: true + condition: or( eq(variables['ForceUpload'], true), and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), or( eq(variables['Build.SourceBranchName'], 'master'), eq(variables['Build.Repository_Name'], 'nf-Community-Targets')) ) ) + displayName: Collecting deployable artifacts + + - task: ArchiveFiles@2 + inputs: + rootFolderOrFile: '$(Build.ArtifactStagingDirectory)\$(BoardName)' + includeRootFolder: false + archiveType: 'zip' + archiveFile: '$(Agent.TempDirectory)\$(BoardName)-$(NBGV_AssemblyVersion)-preview.zip' replaceExistingArchive: true # skip task on PR build and when on branch other than develop, master or release # execute on 'ForceUpload' parameter - condition: or( eq(variables['ForceUpload'], true), and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), or( eq(variables['Build.SourceBranchName'], 'develop'), eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ) ) ) + condition: or( eq(variables['ForceUpload'], true), and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), or( contains(variables['Build.SourceBranchName'], 'develop'), contains(variables['Build.SourceBranchName'], 'release') ) ) ) displayName: Zip binary files + - task: CopyFiles@1 + inputs: + sourceFolder: $(Agent.TempDirectory) + Contents: | + '$(Agent.TempDirectory)\$(BoardName)-$(NBGV_AssemblyVersion)-preview.zip' + TargetFolder: '$(Build.ArtifactStagingDirectory)\$(BoardName)' + flattenFolders: true + condition: or( eq(variables['ForceUpload'], true), and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), or( contains(variables['Build.SourceBranchName'], 'develop'), contains(variables['Build.SourceBranchName'], 'release') ) ) ) + displayName: Collecting deployable artifacts + + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)\$(BoardName)' + ArtifactName: $(BoardName) + ArtifactType: Container + condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') ) + displayName: Publish deployables artifacts + - task: PowerShell@2 inputs: targetType: 'inline' @@ -32,6 +72,8 @@ steps: { # this is a build for a community target Write-Host "$("##vso[task.setvariable variable=BINTRAY_REPO]")nanoframework-images-community-targets" + # set package name + Write-Host "$("##vso[task.setvariable variable=PACKAGE_NAME]")$(BoardName)-$(NBGV_AssemblyVersion)" } else { @@ -40,11 +82,15 @@ steps: { # this a dev or release branch, publish to Bintray dev repo Write-Host "$("##vso[task.setvariable variable=BINTRAY_REPO]")nanoframework-images-dev" + # set package name + Write-Host "$("##vso[task.setvariable variable=PACKAGE_NAME]")$(BoardName)-$(NBGV_AssemblyVersion)-preview" } else { # this master branch, publish to Bintray stable repo Write-Host "$("##vso[task.setvariable variable=BINTRAY_REPO]")nanoframework-images" + # set package name + Write-Host "$("##vso[task.setvariable variable=PACKAGE_NAME]")$(BoardName)-$(NBGV_AssemblyVersion)" } } errorActionPreference: 'stop' @@ -55,12 +101,12 @@ steps: - task: cURLUploader@2 inputs: - files: '$(Agent.TempDirectory)\$(BoardName)-$(NBGV_SimpleVersion)$(NBGV_PrereleaseVersion).zip' + files: '$(Agent.TempDirectory)\$(PACKAGE_NAME).zip' authType: 'userAndPass' username: 'nfbot' password: '$(BinTrayKey)' url: 'https://api.bintray.com/' - remotePath: 'content/nfbot/$(BINTRAY_REPO)/$(BoardName)/$(NBGV_SimpleVersion)$(NBGV_PrereleaseVersion)/$(BoardName)-$(NBGV_SimpleVersion)$(NBGV_PrereleaseVersion).zip;publish=1' + remotePath: 'content/nfbot/$(BINTRAY_REPO)/$(BoardName)/$(NBGV_AssemblyVersion)/$(PACKAGE_NAME).zip;publish=1' # execute on 'ForceUpload' parameter condition: or( eq(variables['ForceUpload'], true), and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), or( eq(variables['Build.SourceBranchName'], 'develop'), eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ) ) ) displayName: Upload artifact to Bintray diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 8c3dfc5f00..8723e83b60 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -365,15 +365,9 @@ jobs: condition: succeeded() displayName: Install NBGV tool - - task: PowerShell@2 - inputs: - targetType: 'inline' - script: nbgv cloud -a -c - errorActionPreference: 'silentlyContinue' - failOnStderr: 'false' + - script: nbgv cloud -a -c condition: succeeded() displayName: Set build number - # condition: ne(variables['system.pullrequest.isfork'], true) - task: UseRubyVersion@0 inputs: @@ -385,7 +379,7 @@ jobs: - powershell: | gem install github_changelog_generator --quiet --no-document # need to call it passing both cache options with full path otherwise it won't work - github_changelog_generator --token $(GitHubToken) --cache-log $env:AGENT_TEMPDIRECTORY\github-changelog-logger.log --cache-file $env:AGENT_TEMPDIRECTORY\github-changelog-http-cache --pr-wo-labels --future-release "v$(NBGV_Version)" + github_changelog_generator --token $(GitHubToken) --cache-log $env:AGENT_TEMPDIRECTORY\github-changelog-logger.log --cache-file $env:AGENT_TEMPDIRECTORY\github-changelog-http-cache --pr-wo-labels --future-release "v$env:NBGV_AssemblyVersion" condition: and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ), or( eq(variables['Build.SourceBranchName'], 'master'), startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ) ) displayName: Generate change log @@ -416,7 +410,7 @@ jobs: displayName: Push changelog to GitHub ####################### -# create or update GitHub release ON tags from release or master branches +# create or update GitHub release ON tags from master branche or tags - job: Publish_Release dependsOn: - Build_STM32_targets @@ -425,27 +419,40 @@ jobs: - Build_TI_SimpleLink_targets - Build_WIN32_nanoCLR - Generate_change_log + # skip build if this is a PR, submitted by nfbot and the commit message contains [version update] + condition: and( succeeded('Build_STM32_targets'), succeeded('Build_ESP32_targets'), succeeded('Build_NXP_targets'), succeeded('Build_TI_SimpleLink_targets'), not( eq(variables['Build.Reason'], 'PullRequest') ), or( endsWith(variables['Build.SourceBranchName'], 'master'), startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ), ne( variables['StartReleaseCandidate'], true ) ) pool: vmImage: 'VS2017-Win2016' steps: + - task: DotNetCoreCLI@2 + inputs: + command: custom + custom: tool + arguments: install --tool-path . nbgv + displayName: Install NBGV tool + + - script: nbgv cloud -a -c + displayName: Set build number + - task: GitHubReleasePublish@1 inputs: githubEndpoint: 'nanoframework' githubOwner: 'nanoframework' githubRepositoryName: nf-interpreter - githubTag: v$(NBGV_Version) - githubReleaseTitle: 'nf Interpreter v$(NBGV_Version)' + githubTag: v$(NBGV_AssemblyVersion) + githubReleaseTitle: 'nf Interpreter v$(NBGV_AssemblyVersion)' + githubReleaseNotes: '' githubTargetCommitsh: $(Build.SourceVersion) githubReleaseDraft: false - githubReleasePrerelease: false + githubReleasePrerelease: true githubReuseDraftOnly: false githubReuseRelease: true githubEditRelease: false githubDeleteEmptyTag: true - githubReleaseAsset: - condition: and( succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), not(contains(variables['Build.SourceBranch'], 'preview') ), ne( variables['StartReleaseCandidate'], true ) ) + githubReleaseAsset: '$(Build.ArtifactStagingDirectory)/**.zip' + condition: endsWith(variables['Build.SourceBranch'], 'master') displayName: Create/Update GitHub stable release ################################## diff --git a/version.json b/version.json index 1ed6a79589..5952bb2326 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "1.4", + "version": "1.4.2", "assemblyVersion": { "precision": "revision" },