Skip to content

Commit

Permalink
should fix publishing to npm
Browse files Browse the repository at this point in the history
  • Loading branch information
zardoy committed Oct 28, 2024
1 parent 153101f commit dbd4058
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .vercel/output/static
force_orphan: true
- name: Set publishing config
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: pnpm tsx scripts/buildNpmReact.ts ${{ steps.release.outputs.tag }}
if: steps.release.outputs.tag
env:
Expand Down
9 changes: 8 additions & 1 deletion scripts/buildNpmReact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ fs.promises.readdir(path.resolve(__dirname, '../src/react')).then(async (files)
fs.copyFileSync(path.resolve(__dirname, '../README.NPM.MD'), path.resolve(__dirname, '../dist-npm/README.md'))

if (version !== '0.0.0-dev') {
execSync('npm publish', { cwd: path.resolve(__dirname, '../dist-npm') })
execSync('npm publish', {
cwd: path.resolve(__dirname, '../dist-npm'),
env: {
...process.env,
NPM_TOKEN: process.env.NPM_TOKEN,
NODE_AUTH_TOKEN: process.env.NPM_TOKEN
}
})
}
})

0 comments on commit dbd4058

Please sign in to comment.