Browse Source

fix(core): Fix admin-ui publish dir in npm publish workflow (#4131)

Michael Bromley 1 week ago
parent
commit
78a606b23c
1 changed files with 8 additions and 3 deletions
  1. 8 3
      .github/workflows/publish_to_npm.yml

+ 8 - 3
.github/workflows/publish_to_npm.yml

@@ -127,17 +127,22 @@ jobs:
       # Publish to npm with appropriate dist-tag
       # Publish to npm with appropriate dist-tag
       # Note: we do not use `lerna publish` because at the time of writing, it fails to publish
       # Note: we do not use `lerna publish` because at the time of writing, it fails to publish
       # using the Trusted Publishing workflow for some reason.
       # using the Trusted Publishing workflow for some reason.
+      # We use a custom script to handle publishConfig.directory for packages like @vendure/admin-ui
+      # that need to publish from a nested directory.
       - name: Publish to NPM (release)
       - name: Publish to NPM (release)
         if: matrix.type == 'release'
         if: matrix.type == 'release'
-        run: npx lerna exec --no-private -- npm publish --access public
+        run: |
+          npx lerna exec --no-private -- 'publish_dir=$(node -p "require(\"./package.json\").publishConfig?.directory || \".\"") && cd "$publish_dir" && npm publish --access public'
 
 
       - name: Publish to NPM (master-nightly)
       - name: Publish to NPM (master-nightly)
         if: matrix.type == 'master-nightly' && steps.commit_check.outputs.should_publish == 'true'
         if: matrix.type == 'master-nightly' && steps.commit_check.outputs.should_publish == 'true'
-        run: npx lerna exec --no-private -- npm publish --access public --tag master
+        run: |
+          npx lerna exec --no-private -- 'publish_dir=$(node -p "require(\"./package.json\").publishConfig?.directory || \".\"") && cd "$publish_dir" && npm publish --access public --tag master'
 
 
       - name: Publish to NPM (minor-nightly)
       - name: Publish to NPM (minor-nightly)
         if: matrix.type == 'minor-nightly' && steps.commit_check.outputs.should_publish == 'true'
         if: matrix.type == 'minor-nightly' && steps.commit_check.outputs.should_publish == 'true'
-        run: npx lerna exec --no-private -- npm publish --dd --access public --tag minor
+        run: |
+          npx lerna exec --no-private -- 'publish_dir=$(node -p "require(\"./package.json\").publishConfig?.directory || \".\"") && cd "$publish_dir" && npm publish --access public --tag minor'
 
 
       - name: Skip publish (no new commits)
       - name: Skip publish (no new commits)
         if: matrix.type != 'release' && steps.commit_check.outputs.should_publish == 'false'
         if: matrix.type != 'release' && steps.commit_check.outputs.should_publish == 'false'