@@ -45,19 +45,20 @@ extends:
4545 environmentsEs6 : true
4646 environmentsNode : true
4747 stages :
48- - stage : main
48+ - stage : Build
49+ displayName : Build & Pack
4950 jobs :
50- - job : NPMPublish
51- displayName : NPM Publish
51+ - job : BuildAndPack
52+ displayName : Build, Test & Pack
5253 pool :
5354 name : Azure-Pipelines-1ESPT-ExDShared
5455 image : ubuntu-latest
5556 os : linux
5657 templateContext :
5758 outputs :
5859 - output : pipelineArtifact
59- targetPath : $(System.DefaultWorkingDirectory)
60- artifactName : dist
60+ targetPath : $(System.DefaultWorkingDirectory)/_packed
61+ artifactName : packed-tarballs
6162 steps :
6263 - task : UseNode@1
6364 inputs :
@@ -70,25 +71,69 @@ extends:
7071
7172 - script : |
7273 yarn buildci
73- 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+ echo "Packed tarballs:"
82+ ls -la $(System.DefaultWorkingDirectory)/_packed/
83+ displayName: 'List packed tarballs'
84+
85+ - stage : Publish
86+ displayName : Publish to NPM
87+ dependsOn : Build
88+ condition : and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), not(${{ parameters.skipNpmPublish }}))
89+ jobs :
90+ - job : PublishPackages
91+ displayName : Publish NPM Packages
92+ pool :
93+ name : Azure-Pipelines-1ESPT-ExDShared
94+ image : ubuntu-latest
95+ os : linux
96+ steps :
97+ - task : UseNode@1
98+ inputs :
99+ version : ' 22.x'
100+ displayName : ' Use Node.js 22.x'
101+
102+ - task : DownloadPipelineArtifact@2
103+ inputs :
104+ artifactName : packed-tarballs
105+ targetPath : $(System.DefaultWorkingDirectory)/_packed
106+ displayName : ' Download packed tarballs'
107+
108+ - script : |
109+ echo "Downloaded tarballs:"
110+ ls -la $(System.DefaultWorkingDirectory)/_packed/
111+ displayName: 'List downloaded tarballs'
112+
113+ - script : |
114+ yarn --immutable
115+ displayName: 'yarn install --immutable'
74116
75117 - script : |
76118 yarn config set npmPublishAccess public
77119 yarn config set npmPublishRegistry "https://registry.npmjs.org"
78120 yarn config set npmAuthToken $(npmAuth)
79121 displayName: 'Configure yarn for npm publishing'
80- condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), not(${{ parameters.skipNpmPublish }}))
81122
82123 - script : |
83124 # https://github.com/changesets/changesets/issues/432
84125 # We can't use `changeset publish` because it doesn't support workspaces, so we have to publish each package individually
85126 yarn lage publish --verbose --grouped --reporter azureDevops
86127 displayName: 'Publish NPM Packages'
87- condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), not(${{ parameters.skipNpmPublish }}))
88128
89129 - script : |
90130 yarn config unset npmPublishAccess
91131 yarn config unset npmAuthToken
92132 yarn config unset npmPublishRegistry
93133 displayName: 'Cleanup yarn npm config'
94134 condition: always()
135+
136+ - script : |
137+ git clean -dfx
138+ displayName: 'Clean up working directory'
139+ condition: always()
0 commit comments