Skip to content

Commit

Permalink
Pipeline fixing (#893)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Roman-Shchukin committed Nov 21, 2022
1 parent cce48d3 commit e7ac209
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 64 deletions.
4 changes: 2 additions & 2 deletions azure-pipelines-steps-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
4 changes: 2 additions & 2 deletions azure-pipelines-steps-test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
91 changes: 31 additions & 60 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ trigger:
- releases/*

variables:
nodeVersion: 16.13.0
- group: npm-tokens
- name: nodeVersion
value: '16.13.0'

jobs:
#################################################
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

0 comments on commit e7ac209

Please sign in to comment.