From e7ac2097a1ba2fa94919f6ff12e9aa755565d3ec Mon Sep 17 00:00:00 2001 From: Roman-Shchukin <111063382+Roman-Shchukin@users.noreply.github.com> Date: Mon, 21 Nov 2022 15:24:53 +0100 Subject: [PATCH] Pipeline fixing (#893) * Token test * Test token * Publish test * call order changed * Nmp token syntax reverted * Changed windows job * Script clearing * Uncommented condition * Token changed * Test - off publish condition * Switched on publish condition * Package version was reverted * Add escape for more correct working --- azure-pipelines-steps-node.yml | 4 +- azure-pipelines-steps-test-build.yml | 4 +- azure-pipelines.yml | 91 ++++++++++------------------ 3 files changed, 35 insertions(+), 64 deletions(-) diff --git a/azure-pipelines-steps-node.yml b/azure-pipelines-steps-node.yml index 8e2591383..bc815e53c 100644 --- a/azure-pipelines-steps-node.yml +++ b/azure-pipelines-steps-node.yml @@ -5,12 +5,12 @@ parameters: steps: # npm install - task: Npm@1 - displayName: (azure-pipelines-task-lib) npm install + displayName: npm install inputs: command: install workingDir: node - task: NodeTool@0 - displayName: (azure-pipelines-task-lib) use node ${{parameters.nodeVersion}} + displayName: use node ${{parameters.nodeVersion}} inputs: versionSpec: ${{parameters.nodeVersion}} diff --git a/azure-pipelines-steps-test-build.yml b/azure-pipelines-steps-test-build.yml index 38ca9e3e9..c4460870d 100644 --- a/azure-pipelines-steps-test-build.yml +++ b/azure-pipelines-steps-test-build.yml @@ -2,9 +2,9 @@ steps: # test - script: node make.js test workingDirectory: node - displayName: (azure-pipelines-task-lib) node make.js test + displayName: node make.js test # build - script: node make.js build - displayName: (azure-pipelines-task-lib) node make.js build + displayName: node make.js build workingDirectory: node diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5a2d2450c..178359f4c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -4,7 +4,9 @@ trigger: - releases/* variables: - nodeVersion: 16.13.0 + - group: npm-tokens + - name: nodeVersion + value: '16.13.0' jobs: ################################################# @@ -15,43 +17,11 @@ jobs: vmImage: windows-2019 steps: - ################################################################################ - # azure-pipelines-task-lib - ################################################################################ - - - template: azure-pipelines-steps-node.yml - parameters: - nodeVersion: $(nodeVersion) + - template: azure-pipelines-steps-node.yml + parameters: + nodeVersion: $(nodeVersion) - # test - - script: | - chcp 437 - node make.js test - workingDirectory: node - displayName: (azure-pipelines-task-lib) node make.js test - - # build - - script: | - chcp 437 - node make.js build - displayName: (azure-pipelines-task-lib) node make.js build - workingDirectory: node - - ################################################################################ - # VstsTaskSdk - ################################################################################ - - # npm install - - task: Npm@1 - displayName: (VstsTaskSdk) npm install - inputs: - command: install - workingDir: powershell - - # npm test - - script: npm test - displayName: (VstsTaskSdk) npm test - workingDirectory: powershell + - template: azure-pipelines-steps-test-build.yml ################################################# - job: linux @@ -61,27 +31,27 @@ jobs: vmImage: ubuntu-18.04 steps: - - template: azure-pipelines-steps-node.yml - parameters: - nodeVersion: $(nodeVersion) - - template: azure-pipelines-steps-test-build.yml + - template: azure-pipelines-steps-node.yml + parameters: + nodeVersion: $(nodeVersion) + + - template: azure-pipelines-steps-test-build.yml - - task: PublishPipelineArtifact@1 - inputs: - targetPath: 'node/_build' - artifactType: 'pipeline' - artifactName: 'npm-package' + - task: PublishPipelineArtifact@1 + inputs: + targetPath: 'node/_build' + artifactType: 'pipeline' + artifactName: 'npm-package' - # For CI runs on master, automatically publish packages - - bash: | - echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc - cd _build - npm publish || true # Ignore publish failures, usually will happen because package already exists - displayName: (azure-pipelines-task-lib) npm publish - workingDirectory: node - condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), in(variables['build.sourcebranch'], 'refs/heads/master', 'refs/heads/releases/4.x')) - env: - NPM_TOKEN: $(npmPublishToken) + # For CI runs on master, automatically publish packages + - bash: | + echo //registry.npmjs.org/:_authToken=\${NPM_TOKEN} > .npmrc + npm publish || true # Ignore publish failures, usually will happen because package already exists + displayName: npm publish + workingDirectory: node/_build + condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), in(variables['build.sourcebranch'], 'refs/heads/master', 'refs/heads/releases/4.x')) + env: + NPM_TOKEN: $(npm-automation.token) ################################################# - job: macOS @@ -91,7 +61,8 @@ jobs: vmImage: macOS-10.15 steps: - - template: azure-pipelines-steps-node.yml - parameters: - nodeVersion: $(nodeVersion) - - template: azure-pipelines-steps-test-build.yml + - template: azure-pipelines-steps-node.yml + parameters: + nodeVersion: $(nodeVersion) + + - template: azure-pipelines-steps-test-build.yml