@@ -7,6 +7,8 @@ variables:
77 value : production,externalfacing
88 - name : serviceTreeID
99 value : 21f0b890-e3a8-4c0b-b9e7-2f764f8b799c
10+ - name : adoMirrorNpmFeedBaseUrl
11+ value : https://pkgs.dev.azure.com/DomoreexpGithub/Github_Pipelines/_packaging/github-npm-mirror/npm/registry/
1012
1113resources :
1214 repositories :
@@ -54,11 +56,34 @@ extends:
5456 - task : NodeTool@0
5557 displayName : " Installing node"
5658 inputs :
57- versionSpec : " 16"
58- - script : yarn --frozen-lockfile
59+ versionSpec : " 18"
60+ - script : |
61+ cat <<'EOF' > "$(Agent.TempDirectory)/npm-mirror.npmrc"
62+ always-auth=true
63+ registry=$(adoMirrorNpmFeedBaseUrl)
64+ EOF
65+ displayName: Create temporary .npmrc for mirror feed
66+ - task : npmAuthenticate@0
67+ inputs :
68+ workingFile : " $(Agent.TempDirectory)/npm-mirror.npmrc"
69+ - script : |
70+ TOKEN=$(grep '_authToken' "$(Agent.TempDirectory)/npm-mirror.npmrc" | head -1 | cut -d'=' -f2)
71+ echo "##vso[task.setvariable variable=NPM_TOKEN;issecret=true]$TOKEN"
72+ displayName: Extract token from .npmrc
73+ - script : |
74+ yarn config set npmAlwaysAuth true
75+ yarn config set npmRegistryServer $(adoMirrorNpmFeedBaseUrl)
76+ displayName: Configure yarn for ADO npm feed
77+ - script : yarn install --immutable
5978 displayName : yarn
79+ env :
80+ YARN_NPM_AUTH_TOKEN : $(NPM_TOKEN)
81+ NPM_CONFIG_USERCONFIG : $(Agent.TempDirectory)/npm-mirror.npmrc
6082 - script : yarn build && yarn test:ci
6183 displayName : build and test [test]
84+ env :
85+ YARN_NPM_AUTH_TOKEN : $(NPM_TOKEN)
86+ NPM_CONFIG_USERCONFIG : $(Agent.TempDirectory)/npm-mirror.npmrc
6287
6388 - script : |
6489 mkdir -p $(System.DefaultWorkingDirectory)/packages
0 commit comments