Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions .ado/azure-pipelines.publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,12 @@ extends:

- script: |
ls -la $(System.DefaultWorkingDirectory)/_packed/
if ls $(System.DefaultWorkingDirectory)/_packed/*.tgz > /dev/null 2>&1; then
echo "##vso[task.setvariable variable=hasTarballs;isOutput=true]true"
else
echo "##vso[task.setvariable variable=hasTarballs;isOutput=true]false"
fi
name: check
displayName: 'List packed tarballs'

- stage: Publish
displayName: Publish to NPM
dependsOn: Build
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne('${{ parameters.skipNpmPublish }}', 'true'), eq(stageDependencies.Build.BuildAndPack.outputs['check.hasTarballs'], 'true'))
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne('${{ parameters.skipNpmPublish }}', 'true'))
jobs:
- job: PublishPackages
displayName: Publish NPM Packages
Expand All @@ -113,24 +107,33 @@ extends:
- script: |
echo "Downloaded tarballs:"
ls -la $(System.DefaultWorkingDirectory)/_packed/
displayName: 'List downloaded tarballs'
if ls $(System.DefaultWorkingDirectory)/_packed/*.tgz > /dev/null 2>&1; then
echo "##vso[task.setvariable variable=hasTarballs]true"
else
echo "No tarballs found — nothing to publish."
echo "##vso[task.setvariable variable=hasTarballs]false"
fi
displayName: 'Check downloaded tarballs'

- script: |
yarn
displayName: 'yarn install'
condition: eq(variables['hasTarballs'], 'true')

- script: |
yarn config set npmPublishAccess public
yarn config set npmPublishRegistry "https://registry.npmjs.org"
yarn config set npmAuthToken $(npmAuth)
npm config set //registry.npmjs.org/:_authToken $(npmAuth)
displayName: 'Configure npm publishing auth'
condition: eq(variables['hasTarballs'], 'true')

- script: |
# https://github.com/changesets/changesets/issues/432
# We can't use `changeset publish` because it doesn't support workspaces, so we have to publish each package individually
yarn lage publish --verbose --grouped --reporter azureDevops
displayName: 'Publish NPM Packages'
condition: eq(variables['hasTarballs'], 'true')

- script: |
yarn config unset npmPublishAccess
Expand Down
Loading