Skip to content
This repository was archived by the owner on Sep 19, 2025. It is now read-only.

Commit 9e1c6c0

Browse files
Use the correct env variable for npm publication token
1 parent c10d0b4 commit 9e1c6c0

File tree

2 files changed

+2
-19
lines changed

2 files changed

+2
-19
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ jobs:
276276
env:
277277
NODE_VERSION: '18.x'
278278
COMPILER_NIGHTLY: ${{ github.event_name == 'schedule' }}
279-
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_AUTH_TOKEN }}
279+
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_AUTH_TOKEN }}
280280
FORCE_COLOR: '1'
281281
needs:
282282
- build-linux

build-scripts/publish.js

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ const path = require('path');
2929
const runCommand = require('./run-command');
3030

3131
const packagesDirPath = path.resolve(__dirname, '../packages');
32-
const npmrcPath = process.env.NPM_CONFIG_USERCONFIG;
3332

3433
async function isPackageVersionPublished(packageName, version) {
3534
return fetch(`https://registry.npmjs.org/${encodeURI(packageName)}/${version}`)
@@ -54,21 +53,6 @@ async function getPackageInfo(packageDir) {
5453
};
5554
}
5655

57-
async function setupNpm() {
58-
// For npm publication to work, the NPM token must be stored in the .npmrc file
59-
console.log('Current .npmrc file:\n', await fs.readFile(npmrcPath, 'utf8'));
60-
if (process.env.GITHUB_ACTIONS && process.env.NPM_TOKEN) {
61-
await fs.appendFile(
62-
npmrcPath,
63-
`\n//registry.npmjs.org/:_authToken=${process.env.NPM_TOKEN}`,
64-
'utf8');
65-
}
66-
}
67-
68-
async function cleanupNpmrc() {
69-
await fs.unlink(npmrcPath);
70-
}
71-
7256
async function publishPackagesIfNeeded(packageInfo) {
7357
const pkgJson = packageInfo.pkg;
7458
const isAlreadyPublished = await isPackageVersionPublished(pkgJson.name, pkgJson.version);
@@ -85,7 +69,6 @@ async function publishPackagesIfNeeded(packageInfo) {
8569
}
8670

8771
(async () => {
88-
await setupNpm();
8972
const packagesDirEntries = await fs.readdir(packagesDirPath);
9073
// build a graph of the interdependencies of projects and only publish
9174
const graph = new graphlib.Graph({directed: true, compound: false});
@@ -130,4 +113,4 @@ async function publishPackagesIfNeeded(packageInfo) {
130113
}
131114
})().catch((e) => {
132115
throw e;
133-
}).finally(cleanupNpmrc);
116+
});

0 commit comments

Comments
 (0)