Skip to content

Commit

Permalink
Fix azure-pipeline.yml (#437)
Browse files Browse the repository at this point in the history
  • Loading branch information
max-zaytsev committed Jun 1, 2023
1 parent e247d17 commit af4afa8
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 15 deletions.
48 changes: 34 additions & 14 deletions .azure-pipelines/azure-pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
trigger:
- master
- releases/*

pool:
vmImage: windows-latest
Expand All @@ -19,19 +20,38 @@ steps:
- script: npm i -g npm@6.14.12 --force
displayName: Use npm version 6.14.12

- script: npm ci
displayName: Install npm-dependencies

- script: npm run build
- bash: |
npm ci
npm run build
displayName: Build TFX CLI

- powershell: |
"//registry.npmjs.org/:_authToken=$env:NPM_TOKEN" | Out-File ".npmrc"
& npm publish --ignore-scripts _build
if ($LASTEXITCODE -eq 1) {
Write-Host "##vso[task.logissue type=warning]Publishing TFX CLI was unsuccessful"
exit 0
}
env:
NPM_TOKEN: $(npm-automation.token)
displayName: Publish TFX CLI
- ${{ if in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual') }}:
# For CI and Manual runs automatically publish packages
# The npm cli will replace ${NPM_TOKEN} with the contents of the NPM_TOKEN environment variable.
- bash: |
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > .npmrc
npm publish --ignore-scripts
exit_status=$?
if [ $exit_status -eq 1 ]; then
echo "##vso[task.logissue type=warning]Publishing TFX CLI was unsuccessful"
echo "##vso[task.complete result=SucceededWithIssues;]"
fi
rm .npmrc
displayName: Publish TFX CLI to npm
env:
NPM_TOKEN: $(npm-automation.token)
# Generate a pipeline artifact so we can publish the package manually if there are issues with automation
- bash: |
npm pack
cp *.tgz '$(Build.ArtifactStagingDirectory)'
displayName: Run npm-pack and copy to ArtifactStagingDirectory
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactType: 'pipeline'
artifactName: 'tfx-cli-package'
displayName: Publish tfx-cli package to pipeline artifacts
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ gulpfile.js
tsconfig.json
tmp/
.vscode/
.github/
.azure-pipelines/
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"clean": "rimraf _build",
"build": "tsc -p .",
"postbuild": "ncp app/tfx-cli.js _build/tfx-cli.js && ncp package.json _build/package.json && ncp app/exec/build/tasks/_resources _build/exec/build/tasks/_resources",
"prepublish": "npm run build"
"prepublishOnly": "npm run build"
},
"dependencies": {
"app-root-path": "1.0.0",
Expand Down

0 comments on commit af4afa8

Please sign in to comment.