@@ -14,17 +14,12 @@ parameters:
1414 displayName : Skip Npm Publish
1515 type : boolean
1616 default : false
17- - name : skipNugetPublish
18- displayName : Skip Nuget Publish
19- type : boolean
20- default : false
2117
2218variables :
2319 - group : ' FluentUI React Native Secrets'
2420 - group : InfoSec-SecurityResults
2521 - name : tags
2622 value : production,externalfacing
27- - template : variables/vars.yml
2823
2924resources :
3025 repositories :
@@ -50,55 +45,102 @@ extends:
5045 environmentsEs6 : true
5146 environmentsNode : true
5247 stages :
53- - stage : main
48+ - stage : Build
49+ displayName : Build & Pack
5450 jobs :
55- - job : NPMPublish
56- displayName : NPM Publish
51+ - job : BuildAndPack
52+ displayName : Build, Test & Pack
5753 pool :
5854 name : Azure-Pipelines-1ESPT-ExDShared
5955 image : ubuntu-latest
6056 os : linux
6157 templateContext :
6258 outputs :
6359 - output : pipelineArtifact
64- targetPath : $(System.DefaultWorkingDirectory)
65- artifactName : dist
60+ targetPath : $(System.DefaultWorkingDirectory)/_packed
61+ artifactName : packed-tarballs
6662 steps :
67- - template : .ado/templates/setup-repo.yml@self
63+ - task : UseNode@1
64+ inputs :
65+ version : ' 22.x'
66+ displayName : ' Use Node.js 22.x'
6867
6968 - script : |
7069 yarn
71- displayName: 'yarn install'
70+ displayName: 'yarn install --immutable '
7271
7372 - script : |
7473 yarn buildci
75- displayName: 'yarn buildci [test]'
74+ displayName: 'yarn buildci [build + test + lint]'
75+
76+ - script : |
77+ yarn lage pack --verbose --grouped
78+ displayName: 'Pack all public packages'
79+
80+ - script : |
81+ ls -la $(System.DefaultWorkingDirectory)/_packed/
82+ if ls $(System.DefaultWorkingDirectory)/_packed/*.tgz > /dev/null 2>&1; then
83+ echo "##vso[task.setvariable variable=hasTarballs;isOutput=true]true"
84+ else
85+ echo "##vso[task.setvariable variable=hasTarballs;isOutput=true]false"
86+ fi
87+ name: check
88+ displayName: 'List packed tarballs'
89+
90+ - stage : Publish
91+ displayName : Publish to NPM
92+ dependsOn : Build
93+ condition : and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), not(${{ parameters.skipNpmPublish }}), eq(stageDependencies.Build.BuildAndPack.outputs['check.hasTarballs'], 'true'))
94+ jobs :
95+ - job : PublishPackages
96+ displayName : Publish NPM Packages
97+ pool :
98+ name : Azure-Pipelines-1ESPT-ExDShared
99+ image : ubuntu-latest
100+ os : linux
101+ steps :
102+ - task : UseNode@1
103+ inputs :
104+ version : ' 22.x'
105+ displayName : ' Use Node.js 22.x'
106+
107+ - task : DownloadPipelineArtifact@2
108+ inputs :
109+ artifactName : packed-tarballs
110+ targetPath : $(System.DefaultWorkingDirectory)/_packed
111+ displayName : ' Download packed tarballs'
112+
113+ - script : |
114+ echo "Downloaded tarballs:"
115+ ls -la $(System.DefaultWorkingDirectory)/_packed/
116+ displayName: 'List downloaded tarballs'
117+
118+ - script : |
119+ yarn --immutable
120+ displayName: 'yarn install --immutable'
76121
77122 - script : |
78123 yarn config set npmPublishAccess public
79124 yarn config set npmPublishRegistry "https://registry.npmjs.org"
80125 yarn config set npmAuthToken $(npmAuth)
81- displayName: 'Configure yarn for npm publishing'
82- condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), not(${{ parameters.skipNpmPublish }}))
126+ npm config set //registry.npmjs.org/:_authToken $(npmAuth)
127+ displayName: 'Configure npm publishing auth'
83128
84129 - script : |
85130 # https://github.com/changesets/changesets/issues/432
86131 # We can't use `changeset publish` because it doesn't support workspaces, so we have to publish each package individually
87132 yarn lage publish --verbose --grouped --reporter azureDevops
88133 displayName: 'Publish NPM Packages'
89- condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), not(${{ parameters.skipNpmPublish }}))
90134
91135 - script : |
92136 yarn config unset npmPublishAccess
93137 yarn config unset npmAuthToken
94138 yarn config unset npmPublishRegistry
95- displayName: 'Cleanup yarn npm config'
139+ npm config delete //registry.npmjs.org/:_authToken
140+ displayName: 'Cleanup npm publishing auth'
96141 condition: always()
97142
98- - template : .ado/templates/win32-nuget-publish.yml@self
99- parameters :
100- skipNugetPublish : ${{ parameters.skipNugetPublish }}
101-
102- - template : .ado/templates/e2e-dependency-nuget-publish.yml@self
103- parameters :
104- skipNugetPublish : ${{ parameters.skipNugetPublish }}
143+ - script : |
144+ git clean -dfx
145+ displayName: 'Clean up working directory'
146+ condition: always()
0 commit comments