@@ -47,29 +47,32 @@ stages:
4747 targetPath : ' $(Build.ArtifactStagingDirectory)'
4848 artifact : ' npm-package'
4949
50- # - stage: PublishPackage
51- # displayName: 'Publish to NPM'
52- # dependsOn: BuildAndTest
53- # condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
54- # jobs:
55- # - job: Publish
56- # displayName: 'Publish to NPM'
57- # steps:
58- # - task: NodeTool@0
59- # displayName: 'Use Node.js $(nodeVersion)'
60- # inputs:
61- # versionSpec: '$(nodeVersion)'
62- #
63- # - script: npm ci
64- # displayName: 'Install dependencies'
65- #
66- # - script: npm run build
67- # displayName: 'Build package'
68- #
69- # - script: |
70- # npm pack
71- # files=( ./*.tgz )
72- # npm publish "${files[0]}" --tag alpha
73- # env:
74- # NPM_TOKEN: $(NPM_TOKEN)
75- # displayName: 'Pack and publish to NPM'
50+ - stage : Deploy_Npm
51+ displayName : Npm release
52+ condition : and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
53+ dependsOn :
54+ - BuildAndTest
55+ jobs :
56+ - job : Publish
57+ displayName : Push to NPM
58+ steps :
59+ - checkout : none
60+ - download : current
61+ artifact : ' npm-package'
62+ - bash : echo "@umbraco-cms:registry=https://registry.npmjs.org" >> .npmrc
63+ workingDirectory : $(Pipeline.Workspace)/npm-package
64+ displayName : Add scoped registry to .npmrc
65+ - task : npmAuthenticate@0
66+ displayName : Authenticate with npm
67+ inputs :
68+ workingFile : $(Pipeline.Workspace)/npm-package/.npmrc
69+ customEndpoint : " NPM - Umbraco Backoffice"
70+ - script : |
71+ # Setup temp npm project to load in defaults from the local .npmrc
72+ npm init -y
73+
74+ # Find the first .tgz file in the current directory and publish it
75+ files=( ./*.tgz )
76+ npm publish "${files[0]}"
77+ displayName: Push to npm
78+ workingDirectory: $(Pipeline.Workspace)/npm-package
0 commit comments