1414 with :
1515 version : 9
1616
17- # CHANGE: Updated Node.js to a version that matches your package.json 'engines' field.
1817 - uses : actions/setup-node@v5
1918 with :
2019 node-version : 22
@@ -23,22 +22,19 @@ jobs:
2322 - run : pnpm install --frozen-lockfile
2423 - run : pnpm run build
2524
26- # ADDED: Upload the 'dist' directory and the 'package.json' as an artifact.
27- # This makes the build output available to the publish job.
25+ # CHANGE: Also upload the lockfile to ensure consistent dependencies in the next job.
2826 - uses : actions/upload-artifact@v4
2927 with :
3028 name : package-artifact
3129 path : |
3230 dist/
3331 package.json
32+ pnpm-lock.yaml
3433
3534 publish-npm :
36- # This job now depends on the 'build' job to complete successfully.
3735 needs : build
3836 runs-on : ubuntu-latest
3937 steps :
40- # We don't need to check out the code again, as we'll use the artifact.
41- # ADDED: Download the artifact from the 'build' job.
4238 - uses : actions/download-artifact@v4
4339 with :
4440 name : package-artifact
@@ -47,15 +43,15 @@ jobs:
4743 with :
4844 version : 9
4945
50- # CHANGE: Updated Node.js version here as well for consistency.
5146 - uses : actions/setup-node@v5
5247 with :
5348 node-version : 22
5449 registry-url : https://registry.npmjs.org/
5550
56- # We don't need to run 'pnpm install' because the publish command will handle it.
57- # CHANGE: Added '--no-git-checks' to bypass the branch check in the CI environment.
58- # We also specify the directory to publish from, which is now the root of our downloaded artifact.
51+ # ADDED: Install dependencies using the lockfile from the build job.
52+ # This makes commands like 'tsup' available to the 'prepare' script that runs before publishing.
53+ - run : pnpm install --frozen-lockfile
54+
5955 - run : pnpm publish --no-git-checks
6056 env :
6157 NODE_AUTH_TOKEN : ${{secrets.NPM_TOKEN}}
0 commit comments