Skip to content

Commit 5f1e975

Browse files
petebacondarwinjosephperrott
authored andcommitted
build(docs-infra): ensure that deployment works on CI (angular#39535)
The actual "main" part of the script that is executed was using an uninitialized variable. This is fixed and a test is added to check. PR Close angular#39535
1 parent ad62eda commit 5f1e975

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

aio/scripts/deploy-to-firebase.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ if (require.main === module) {
3030
console.log(deploymentInfo.reason);
3131
} else {
3232
console.log(
33-
`Git branch : ${currentBranch}\n` +
33+
`Git branch : ${inputVars.currentBranch}\n` +
3434
`Build/deploy mode : ${deploymentInfo.deployEnv}\n` +
3535
`Firebase project : ${deploymentInfo.projectId}\n` +
3636
`Firebase site : ${deploymentInfo.siteId}\n` +

aio/scripts/deploy-to-firebase.spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env node
22
'use strict';
33

4+
const {execSync} = require('child_process');
45
const {computeDeploymentInfo, computeInputVars, getLatestCommit} = require('./deploy-to-firebase');
56

67

@@ -259,4 +260,23 @@ describe('deploy-to-firebase:', () => {
259260
'There is a more recent branch with the same major version: "4.4.x"',
260261
});
261262
});
263+
264+
it('integration - should run the main script without error', () => {
265+
const cmd = `"${process.execPath}" "${__dirname}/deploy-to-firebase" --dry-run`;
266+
const env = {
267+
CI_REPO_OWNER: 'angular',
268+
CI_REPO_NAME: 'angular',
269+
CI_PULL_REQUEST: 'false',
270+
CI_BRANCH: 'master',
271+
CI_COMMIT: getLatestCommit('master')
272+
};
273+
const result = execSync(cmd, {encoding: 'utf8', env}).trim();
274+
expect(result).toBe(
275+
'Git branch : master\n' +
276+
'Build/deploy mode : next\n' +
277+
'Firebase project : angular-io\n' +
278+
'Firebase site : next-angular-io-site\n' +
279+
'Deployment URLs : https://next.angular.io/\n' +
280+
' https://next-angular-io-site.web.app/');
281+
});
262282
});

0 commit comments

Comments
 (0)