185 строки
5.2 KiB
YAML
185 строки
5.2 KiB
YAML
# Copyright (c) .NET Foundation and Contributors
|
|
# See LICENSE file in the project root for full license information.
|
|
|
|
trigger:
|
|
branches:
|
|
include:
|
|
- main
|
|
- develop
|
|
- release-*
|
|
paths:
|
|
exclude:
|
|
- .github_changelog_generator
|
|
- .gitignore
|
|
- .markdownlint.json
|
|
- CHANGELOG.md
|
|
- LICENSE.md
|
|
- README.md
|
|
- assets/*
|
|
- config/*
|
|
- .github/*
|
|
- .vscodeignore
|
|
- .gitmodules
|
|
tags:
|
|
include:
|
|
- v*
|
|
- refs/tags/v*
|
|
|
|
# PR always trigger build
|
|
pr:
|
|
autoCancel: true
|
|
|
|
# add nf-tools repo to resources (for Azure Pipelines templates)
|
|
resources:
|
|
repositories:
|
|
- repository: templates
|
|
type: github
|
|
name: nanoframework/nf-tools
|
|
endpoint: nanoframework
|
|
|
|
pool:
|
|
vmImage: 'windows-latest'
|
|
|
|
variables:
|
|
- group: sign-client-credentials
|
|
- name: DOTNET_NOLOGO
|
|
value: true
|
|
|
|
steps:
|
|
|
|
# need this here in order to persist GitHub credentials
|
|
- checkout: self
|
|
persistCredentials: true
|
|
|
|
- pwsh: scripts/build.ps1
|
|
displayName: Download and build dependencies for .NET nanoFramework
|
|
|
|
- task: DeleteFiles@1
|
|
displayName: Remove source folders
|
|
condition: succeeded()
|
|
inputs:
|
|
Contents: |
|
|
v*.zip
|
|
|
|
- script: npm ci
|
|
displayName: npm ci
|
|
condition: succeeded()
|
|
|
|
# we don't have unit tests
|
|
# - script: npm run test
|
|
# displayName: Run unit tests
|
|
# condition: succeeded()
|
|
|
|
- script: npm run build:prod
|
|
displayName: Build for production
|
|
condition: succeeded()
|
|
|
|
- script: npm run package
|
|
env:
|
|
PublicRelease: true
|
|
displayName: Package extension
|
|
condition: succeeded()
|
|
|
|
- task: DotNetCoreCLI@2
|
|
displayName: Install Sign Client CLI
|
|
condition: >-
|
|
and(
|
|
succeeded(),
|
|
startsWith(variables['Build.SourceBranch'], 'refs/tags/v')
|
|
)
|
|
inputs:
|
|
command: custom
|
|
custom: tool
|
|
arguments: install --tool-path . sign --version 0.9.1-beta.24312.3
|
|
|
|
- pwsh: |
|
|
.\sign code azure-key-vault `
|
|
"**/*.vsix" `
|
|
--base-directory "$(Build.Repository.LocalPath)" `
|
|
--file-list "$(Build.Repository.LocalPath)\config\filelist.txt" `
|
|
--description ".NET nanoFramework VS Code Extension" `
|
|
--description-url "https://github.com/$env:Build_Repository_Name" `
|
|
--azure-key-vault-tenant-id "$(SignTenantId)" `
|
|
--azure-key-vault-client-id "$(SignClientId)" `
|
|
--azure-key-vault-client-secret "$(SignClientSecret)" `
|
|
--azure-key-vault-certificate "$(SignKeyVaultCertificate)" `
|
|
--azure-key-vault-url "$(SignKeyVaultUrl)" `
|
|
--timestamp-url http://timestamp.digicert.com
|
|
displayName: Sign packages
|
|
continueOnError: true
|
|
condition: >-
|
|
and(
|
|
succeeded(),
|
|
startsWith(variables['Build.SourceBranch'], 'refs/tags/v')
|
|
)
|
|
|
|
- bash: |
|
|
echo ">>> Publish"
|
|
yarn deploy
|
|
displayName: Publish to marketplace
|
|
condition: >-
|
|
and(
|
|
succeeded(),
|
|
startsWith(variables['Build.SourceBranch'], 'refs/tags/v')
|
|
)
|
|
env:
|
|
VSCE_PAT: $(VSCE_PAT)
|
|
|
|
- task: CopyFiles@2
|
|
displayName: Collecting deployable artifacts
|
|
condition: succeeded()
|
|
inputs:
|
|
sourceFolder: $(Build.SourcesDirectory)
|
|
contents: |-
|
|
**\vscode-nanoframework.vsix
|
|
**\package.json
|
|
assets/marketplace/vscode-marketplace-overview.md
|
|
assets/marketplace/nano-vs-code.gif
|
|
targetFolder: $(Build.ArtifactStagingDirectory)
|
|
flattenFolders: true
|
|
|
|
# Publish files as an artifact
|
|
- task: PublishBuildArtifacts@1
|
|
displayName: Publish deployables artifacts
|
|
condition: succeeded()
|
|
inputs:
|
|
ArtifactName: git-mob-vs-code
|
|
PathtoPublish: $(Build.ArtifactStagingDirectory)
|
|
ArtifactType: Container
|
|
|
|
# create or update GitHub release
|
|
- task: GithubRelease@1
|
|
condition: >-
|
|
and(
|
|
succeeded(),
|
|
eq(variables['System.PullRequest.PullRequestId'], ''),
|
|
ne(variables['StartReleaseCandidate'], true),
|
|
not(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
|
|
)
|
|
displayName: Create/Update GitHub release
|
|
inputs:
|
|
gitHubConnection: 'github.com_nano-$(System.TeamProject)'
|
|
tagSource: userSpecifiedTag
|
|
tag: v$(NBGV_SimpleVersion)
|
|
title: '.NET nanoFramework VS Code extension v$(NBGV_SimpleVersion)'
|
|
assets: '$(Build.ArtifactStagingDirectory)/*.vsix'
|
|
isPreRelease: false
|
|
addChangeLog: true
|
|
releaseNotesSource: inline
|
|
changeLogType: issueBased
|
|
changeLogLabels: |
|
|
[
|
|
{ "label" : "Type: bug", "displayName" : "Bugs fixed", "state" : "closed" },
|
|
{ "label" : "Type: enhancement", "displayName" : "Enhancements and new features", "state" : "closed" },
|
|
{ "label" : "Breaking-Change", "displayName" : "Breaking Changes", "state" : "closed" },
|
|
{ "label" : "Type: dependencies", "displayName" : "Dependencies updated", "state" : "closed" },
|
|
{ "label" : "Type: documentation", "displayName" : "Documentation", "state" : "closed" }
|
|
]
|
|
|
|
# report error
|
|
- template: azure-pipelines-templates/discord-webhook-task.yml@templates
|
|
parameters:
|
|
status: 'failure'
|
|
webhookUrl: '$(DiscordWebhook)'
|
|
message: ''
|