Skip to content

Commit f90da88

Browse files
authored
Merge pull request #18 from umbraco/feature/fix-azure-pipeline-deployment
Fix Azure Pipeline deployment to only run on main branch
2 parents 45cce11 + c66e94b commit f90da88

File tree

1 file changed

+29
-26
lines changed

1 file changed

+29
-26
lines changed

build/azure-pipelines.yml

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)