Skip to content

Commit 43c67ac

Browse files
authored
Set canary publish to use wombot (#2690)
1 parent 48e6271 commit 43c67ac

File tree

3 files changed

+59
-12
lines changed

3 files changed

+59
-12
lines changed

.github/workflows/test-all.yml

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,41 @@ jobs:
5555
uses: actions/setup-node@v1
5656
with:
5757
node-version: 10.x
58-
registry-url: 'https://registry.npmjs.org'
5958
- name: Yarn install
6059
run: yarn
61-
- name: yarn build
62-
run: yarn build
6360
- name: Deploy canary
64-
run: |
65-
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
66-
yarn release --canary
61+
run: yarn release --canary
6762
env:
68-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
63+
NPM_TOKEN_ANALYTICS: ${{secrets.NPM_TOKEN_ANALYTICS}}
64+
NPM_TOKEN_ANALYTICS_INTEROP_TYPES: ${{secrets.NPM_TOKEN_ANALYTICS_INTEROP_TYPES}}
65+
NPM_TOKEN_ANALYTICS_TYPES: ${{secrets.NPM_TOKEN_ANALYTICS_TYPES}}
66+
NPM_TOKEN_APP: ${{secrets.NPM_TOKEN_APP}}
67+
NPM_TOKEN_APP_TYPES: ${{secrets.NPM_TOKEN_APP_TYPES}}
68+
NPM_TOKEN_AUTH: ${{secrets.NPM_TOKEN_AUTH}}
69+
NPM_TOKEN_AUTH_INTEROP_TYPES: ${{secrets.NPM_TOKEN_AUTH_INTEROP_TYPES}}
70+
NPM_TOKEN_AUTH_TYPES: ${{secrets.NPM_TOKEN_AUTH_TYPES}}
71+
NPM_TOKEN_COMPONENT: ${{secrets.NPM_TOKEN_COMPONENT}}
72+
NPM_TOKEN_DATABASE: ${{secrets.NPM_TOKEN_DATABASE}}
73+
NPM_TOKEN_DATABASE_TYPES: ${{secrets.NPM_TOKEN_DATABASE_TYPES}}
74+
NPM_TOKEN_FIRESTORE: ${{secrets.NPM_TOKEN_FIRESTORE}}
75+
NPM_TOKEN_FIRESTORE_TYPES: ${{secrets.NPM_TOKEN_FIRESTORE_TYPES}}
76+
NPM_TOKEN_FUNCTIONS: ${{secrets.NPM_TOKEN_FUNCTIONS}}
77+
NPM_TOKEN_FUNCTIONS_TYPES: ${{secrets.NPM_TOKEN_FUNCTIONS_TYPES}}
78+
NPM_TOKEN_INSTALLATIONS: ${{secrets.NPM_TOKEN_INSTALLATIONS}}
79+
NPM_TOKEN_INSTALLATIONS_TYPES: ${{secrets.NPM_TOKEN_INSTALLATIONS_TYPES}}
80+
NPM_TOKEN_LOGGER: ${{secrets.NPM_TOKEN_LOGGER}}
81+
NPM_TOKEN_MESSAGING: ${{secrets.NPM_TOKEN_MESSAGING}}
82+
NPM_TOKEN_MESSAGING_TYPES: ${{secrets.NPM_TOKEN_MESSAGING_TYPES}}
83+
NPM_TOKEN_PERFORMANCE: ${{secrets.NPM_TOKEN_PERFORMANCE}}
84+
NPM_TOKEN_PERFORMANCE_TYPES: ${{secrets.NPM_TOKEN_PERFORMANCE_TYPES}}
85+
NPM_TOKEN_POLYFILL: ${{secrets.NPM_TOKEN_POLYFILL}}
86+
NPM_TOKEN_REMOTE_CONFIG: ${{secrets.NPM_TOKEN_REMOTE_CONFIG}}
87+
NPM_TOKEN_REMOTE_CONFIG_TYPES: ${{secrets.NPM_TOKEN_REMOTE_CONFIG_TYPES}}
88+
NPM_TOKEN_STORAGE: ${{secrets.NPM_TOKEN_STORAGE}}
89+
NPM_TOKEN_STORAGE_TYPES: ${{secrets.NPM_TOKEN_STORAGE_TYPES}}
90+
NPM_TOKEN_TESTING: ${{secrets.NPM_TOKEN_TESTING}}
91+
NPM_TOKEN_UTIL: ${{secrets.NPM_TOKEN_UTIL}}
92+
NPM_TOKEN_WEBCHANNEL_WRAPPER: ${{secrets.NPM_TOKEN_WEBCHANNEL_WRAPPER}}
93+
NPM_TOKEN_FIREBASE: ${{secrets.NPM_TOKEN_FIREBASE}}
94+
NPM_TOKEN_RXFIRE: ${{secrets.NPM_TOKEN_RXFIRE}}
95+
CI: true

scripts/release/cli.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,10 @@ const { argv } = require('yargs');
7979
/**
8080
* Log the user who will be publishing the packages
8181
*/
82-
const { stdout: whoami } = await exec('npm whoami');
83-
console.log(`Publishing as ${whoami}`);
82+
if (!process.env.CI) {
83+
const { stdout: whoami } = await exec('npm whoami');
84+
console.log(`Publishing as ${whoami}`);
85+
}
8486

8587
/**
8688
* Determine if the current release is a staging or production release

scripts/release/utils/npm.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,24 @@
1616
*/
1717

1818
const { projectRoot: root } = require('./constants');
19-
const { spawn } = require('child-process-promise');
19+
const { spawn, exec } = require('child-process-promise');
2020
const { mapPkgNameToPkgPath } = require('./workspace');
2121
const { readFile: _readFile } = require('fs');
2222
const { promisify } = require('util');
2323
const Listr = require('listr');
2424
const readFile = promisify(_readFile);
2525

26+
/**
27+
* Given NPM package name, get env variable name for its publish token.
28+
* @param {string} packageName NPM package name
29+
*/
30+
function getEnvTokenKey(packageName) {
31+
let result = packageName.replace('@firebase/', '');
32+
result = result.replace(/-/g, '_');
33+
result = result.toUpperCase();
34+
return `NPM_TOKEN_${result}`;
35+
}
36+
2637
async function publishPackage(pkg, releaseType) {
2738
try {
2839
const path = await mapPkgNameToPkgPath(pkg);
@@ -48,9 +59,16 @@ async function publishPackage(pkg, releaseType) {
4859
if (releaseType === 'Staging') {
4960
args = [...args, '--tag', 'next'];
5061
} else if (releaseType === 'Canary') {
51-
args = [...args, '--tag', 'canary'];
62+
// Write proxy registry token for this package to .npmrc.
63+
await exec(`echo "//wombat-dressing-room.appspot.com/:_authToken=${process.env[getEnvTokenKey(pkg)]}" >> ~/.npmrc`);
64+
args = [
65+
...args,
66+
'--tag',
67+
'canary',
68+
'--registry',
69+
`https://wombat-dressing-room.appspot.com`
70+
];
5271
}
53-
5472
return spawn('npm', args, { cwd: path });
5573
} catch (err) {
5674
throw err;

0 commit comments

Comments
 (0)