azure-pipelines-vscode/.azure-pipelines/common-steps.yml

107 строки
2.8 KiB
YAML

# Common steps template
#
# Things which happen regardless of CI, PR, or release builds
steps:
- task: NodeTool@0
displayName: Install Node 16 LTS or greater
inputs:
versionSpec: ">=16.13.0"
- task: NpmAuthenticate@0
inputs:
workingFile: .npmrc
- script: npm ci
displayName: npm ci
- script: npm run compile
displayName: Build extension
# TODO: call the schema endpoint to generate the shipped schema file
# - script: |
# echo no-op
# displayName: Generate service-schema.json
- script: Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
displayName: Start xvfb
- script: npm run test
displayName: Run tests
env:
DISPLAY: ':99.0'
- script: npm run lint
displayName: Lint
# Acquire the `vsce` tool and use it to package
- script: |
npm install -g @vscode/vsce
displayName: Install VSCE
- script: |
npx @vscode/vsce package -o extension.vsix
displayName: Create VSIX
- script: |
npx @vscode/vsce generate-manifest -i extension.vsix -o extension.manifest
displayName: Create VSIX Manifest
- script: |
cp extension.manifest extension.signature.p7s
displayName: Prepare Manifest Signature
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5
inputs:
ConnectedServiceName: PipelinesAgentAndTasksESRP
AppRegistrationClientId: $(AppRegistrationClientId)
AppRegistrationTenantId: $(AppRegistrationTenantId)
AuthAKVName: $(AuthAKVName)
AuthCertName: $(AuthCertName)
AuthSignCertName: $(AuthSignCertName)
FolderPath: '$(Build.SourcesDirectory)'
Pattern: 'extension.signature.p7s'
signConfigType: inlineSignParams
inlineOperation: |
[
{
"keyCode": "CP-401405",
"operationSetCode": "VSCodePublisherSign",
"parameters" : [],
"toolName": "sign",
"toolVersion": "1.0"
}
]
SessionTimeout: 90
MaxConcurrency: 25
MaxRetryAttempts: 5
PendingAnalysisWaitTimeoutMinutes: 5
displayName: Sign Extension
- script: |
npm run vscode:prepublish
cat /home/vsts/.npm/_logs/*.log
displayName: Echo npm error logs on failure
condition: failed()
# For releasable builds, we'll want the branch and the changelog
# Expects that a 'version.txt' has been laid down by a previous step
- bash: |
echo $(Build.SourceBranch) | sed "s|refs/[^/]*/||" > branch.txt
PACKAGE_VERSION=$(cat version.txt)
VERSION_REGEX="## $(echo $PACKAGE_VERSION | sed 's/\./\\./g')"
sed -n "/$VERSION_REGEX/,/## 1\..*/p" CHANGELOG.md | head -n -2 > minichangelog.txt
displayName: Get branch and mini-changelog
# Choose files to publish
- task: CopyFiles@2
displayName: Stage VSIX for publishing
inputs:
contents: |-
extension.vsix
version.txt
branch.txt
minichangelog.txt
extension.signature.p7s
extension.manifest
targetFolder: $(Build.ArtifactStagingDirectory)