autorest/.scripts/push-to-npm.yaml

51 строка
1.6 KiB
YAML
Исходник Постоянная ссылка Обычный вид История

2021-03-15 19:57:54 +03:00
# publishes a package to NPM (passed in as $(pkg) variable)
# you can also customize the tag used for NPM with the $(tag) variable (defaults to 'latest')
# if you want to set a secondary tag on the package (like V2), set the $(altTag) variable
trigger:
- v2
2021-03-15 19:57:54 +03:00
extends:
template: /eng/pipelines/templates/1es-redirect.yml
parameters:
stages:
- stage: Publish_Stage
jobs:
- job:
displayName: NPM Publishing
2021-03-15 19:57:54 +03:00
pool:
name: $(LINUXNEXTPOOL)
image: $(LINUXNEXTVMIMAGE)
os: linux
2021-03-15 19:57:54 +03:00
steps:
- task: NodeTool@0
inputs:
versionSpec: "12.x"
displayName: "Install Node.js"
- script: |
npm config set //registry.npmjs.org/:_authToken=$(azure-sdk-npm-token)
# grab the file specified
wget $(pkg)
rc=$?; if [ $rc -ne 0 ]; then exit $rc ; fi
# determine the tag
npmTag="latest"
if [ -n "$(tag)" ]; then
npmTag=$(tag)
fi
# publish it to npm
for file in *.tgz
do
npm publish $file --tag $npmTag --access public
rc=$?; if [ $rc -ne 0 ]; then exit $rc ; fi
# set the alternate tag, if applicable
if [ -n "$(altTag)" ]; then
tar -zxvf $file
cd package/
npm dist-tag add $(npm show . name)@$(npm show . version) --tag $(altTag)
fi
done
displayName: "Publish to NPM"