File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4545 OSS_SECRET_KEY : ${{ secrets.OSS_SECRET_KEY }}
4646
4747 publish-npm :
48- needs : deploy-prod
48+ # needs: deploy-prod
4949 runs-on : ubuntu-latest
5050 steps :
5151 - name : Checkout code
6060 - name : Install dependencies
6161 run : yarn
6262
63- - name : Debug NPM token
64- run : |
65- echo "Token prefix: ${NODE_AUTH_TOKEN:0:4}..."
66- npm whoami
67-
6863 - name : Publish to NPM
6964 run : node ./scripts/deploy/publish-npm.js
7065 env :
Original file line number Diff line number Diff line change @@ -2,13 +2,17 @@ const fs = require('fs')
22const { printLog, runMain } = require ( '../lib/executionUtils' )
33const { command } = require ( '../lib/command' )
44const { getNpmToken } = require ( '../lib/secrets' )
5+ const dotenv = require ( 'dotenv' )
6+ dotenv . config ( )
57
68runMain ( ( ) => {
79 printLog ( 'Building the project' )
810 command `yarn build` . withEnvironment ( { BUILD_MODE : 'release' } ) . run ( )
9-
11+ if ( ! process . env . NPM_TOKEN ) {
12+ throw new Error ( 'NPM_TOKEN is not set' )
13+ }
1014 printLog ( 'Publishing' )
1115 // eslint-disable-next-line no-template-curly-in-string
12- // fs.writeFileSync('.npmrc', ' //registry.npmjs.org/:_authToken=${NPM_TOKEN}' )
13- command `yarn lerna publish from-package --yes` . withEnvironment ( { NPM_TOKEN : getNpmToken ( ) } ) . run ( )
16+ fs . writeFileSync ( '.npmrc' , ` //registry.npmjs.org/:_authToken=${ process . env . NPM_TOKEN } ` )
17+ command `yarn lerna publish from-package --yes` . withEnvironment ( { NPM_TOKEN : process . env . NPM_TOKEN } ) . run ( )
1418} )
Original file line number Diff line number Diff line change 11const { command } = require ( '../lib/command' )
2- const dotenv = require ( 'dotenv' )
3-
4- dotenv . config ( )
52
63function getGithubDeployKey ( ) {
74 return getSecretKey ( 'ci.browser-sdk.github_deploy_key' )
@@ -30,8 +27,7 @@ function getTelemetryOrgApplicationKey(site) {
3027}
3128
3229function getNpmToken ( ) {
33- // return getSecretKey('ci.browser-sdk.npm_token')
34- return process . env . NPM_TOKEN || ''
30+ return getSecretKey ( 'ci.browser-sdk.npm_token' )
3531}
3632
3733function getChromeWebStoreClientId ( ) {
You can’t perform that action at this time.
0 commit comments