Skip to content

Commit 0c70641

Browse files
chore(release): 3.1.0 [skip ci]
# [3.1.0](v3.0.1...v3.1.0) (2023-02-17) ### Features * **deps:** bump @actions/core from 1.9.1 to 1.10.0 ([94ebd91](94ebd91)) * **deps:** bump @semantic-release/changelog from 6.0.1 to 6.0.2 ([01cf92a](01cf92a)) * **deps:** bump @vercel/ncc from 0.34.0 to 0.36.0 ([6308ee2](6308ee2)) * **deps:** bump @vercel/ncc from 0.36.0 to 0.36.1 ([7eaedf5](7eaedf5))
1 parent 044bf33 commit 0c70641

File tree

3 files changed

+47
-22
lines changed

3 files changed

+47
-22
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# [3.1.0](https://github.com/sws2apps/firebase-deployment/compare/v3.0.1...v3.1.0) (2023-02-17)
2+
3+
4+
### Features
5+
6+
* **deps:** bump @actions/core from 1.9.1 to 1.10.0 ([94ebd91](https://github.com/sws2apps/firebase-deployment/commit/94ebd91804fd9e1d60e47cc650b33fa2bf6ae600))
7+
* **deps:** bump @semantic-release/changelog from 6.0.1 to 6.0.2 ([01cf92a](https://github.com/sws2apps/firebase-deployment/commit/01cf92aac7b32b8eb2f2868e66b185465e2023b1))
8+
* **deps:** bump @vercel/ncc from 0.34.0 to 0.36.0 ([6308ee2](https://github.com/sws2apps/firebase-deployment/commit/6308ee25fa2f47132b6fc3a9ca4ba7d3fe36bc33))
9+
* **deps:** bump @vercel/ncc from 0.36.0 to 0.36.1 ([7eaedf5](https://github.com/sws2apps/firebase-deployment/commit/7eaedf5012aab3a5bb7c68317f6bb217f69cb941))
10+
111
## [3.0.1](https://github.com/sws2apps/firebase-deployment/compare/v3.0.0...v3.0.1) (2022-09-24)
212

313

dist/index.js

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ const file_command_1 = __nccwpck_require__(717);
138138
const utils_1 = __nccwpck_require__(278);
139139
const os = __importStar(__nccwpck_require__(37));
140140
const path = __importStar(__nccwpck_require__(17));
141-
const uuid_1 = __nccwpck_require__(840);
142141
const oidc_utils_1 = __nccwpck_require__(41);
143142
/**
144143
* The code to exit an action
@@ -168,20 +167,9 @@ function exportVariable(name, val) {
168167
process.env[name] = convertedVal;
169168
const filePath = process.env['GITHUB_ENV'] || '';
170169
if (filePath) {
171-
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
172-
// These should realistically never happen, but just in case someone finds a way to exploit uuid generation let's not allow keys or values that contain the delimiter.
173-
if (name.includes(delimiter)) {
174-
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
175-
}
176-
if (convertedVal.includes(delimiter)) {
177-
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
178-
}
179-
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
180-
file_command_1.issueCommand('ENV', commandValue);
181-
}
182-
else {
183-
command_1.issueCommand('set-env', { name }, convertedVal);
170+
return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val));
184171
}
172+
command_1.issueCommand('set-env', { name }, convertedVal);
185173
}
186174
exports.exportVariable = exportVariable;
187175
/**
@@ -199,7 +187,7 @@ exports.setSecret = setSecret;
199187
function addPath(inputPath) {
200188
const filePath = process.env['GITHUB_PATH'] || '';
201189
if (filePath) {
202-
file_command_1.issueCommand('PATH', inputPath);
190+
file_command_1.issueFileCommand('PATH', inputPath);
203191
}
204192
else {
205193
command_1.issueCommand('add-path', {}, inputPath);
@@ -239,7 +227,10 @@ function getMultilineInput(name, options) {
239227
const inputs = getInput(name, options)
240228
.split('\n')
241229
.filter(x => x !== '');
242-
return inputs;
230+
if (options && options.trimWhitespace === false) {
231+
return inputs;
232+
}
233+
return inputs.map(input => input.trim());
243234
}
244235
exports.getMultilineInput = getMultilineInput;
245236
/**
@@ -272,8 +263,12 @@ exports.getBooleanInput = getBooleanInput;
272263
*/
273264
// eslint-disable-next-line @typescript-eslint/no-explicit-any
274265
function setOutput(name, value) {
266+
const filePath = process.env['GITHUB_OUTPUT'] || '';
267+
if (filePath) {
268+
return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value));
269+
}
275270
process.stdout.write(os.EOL);
276-
command_1.issueCommand('set-output', { name }, value);
271+
command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value));
277272
}
278273
exports.setOutput = setOutput;
279274
/**
@@ -402,7 +397,11 @@ exports.group = group;
402397
*/
403398
// eslint-disable-next-line @typescript-eslint/no-explicit-any
404399
function saveState(name, value) {
405-
command_1.issueCommand('save-state', { name }, value);
400+
const filePath = process.env['GITHUB_STATE'] || '';
401+
if (filePath) {
402+
return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value));
403+
}
404+
command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value));
406405
}
407406
exports.saveState = saveState;
408407
/**
@@ -467,13 +466,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
467466
return result;
468467
};
469468
Object.defineProperty(exports, "__esModule", ({ value: true }));
470-
exports.issueCommand = void 0;
469+
exports.prepareKeyValueMessage = exports.issueFileCommand = void 0;
471470
// We use any as a valid input type
472471
/* eslint-disable @typescript-eslint/no-explicit-any */
473472
const fs = __importStar(__nccwpck_require__(147));
474473
const os = __importStar(__nccwpck_require__(37));
474+
const uuid_1 = __nccwpck_require__(840);
475475
const utils_1 = __nccwpck_require__(278);
476-
function issueCommand(command, message) {
476+
function issueFileCommand(command, message) {
477477
const filePath = process.env[`GITHUB_${command}`];
478478
if (!filePath) {
479479
throw new Error(`Unable to find environment variable for file command ${command}`);
@@ -485,7 +485,22 @@ function issueCommand(command, message) {
485485
encoding: 'utf8'
486486
});
487487
}
488-
exports.issueCommand = issueCommand;
488+
exports.issueFileCommand = issueFileCommand;
489+
function prepareKeyValueMessage(key, value) {
490+
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
491+
const convertedValue = utils_1.toCommandValue(value);
492+
// These should realistically never happen, but just in case someone finds a
493+
// way to exploit uuid generation let's not allow keys or values that contain
494+
// the delimiter.
495+
if (key.includes(delimiter)) {
496+
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
497+
}
498+
if (convertedValue.includes(delimiter)) {
499+
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
500+
}
501+
return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`;
502+
}
503+
exports.prepareKeyValueMessage = prepareKeyValueMessage;
489504
//# sourceMappingURL=file-command.js.map
490505

491506
/***/ }),

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "firebase-deployment",
33
"description": "A GitHub Action to deploy firebase hosting and functions together.",
4-
"version": "3.0.1",
4+
"version": "3.1.0",
55
"private": true,
66
"type": "module",
77
"homepage": "https://github.com/sws2apps/firebase-deployment#readme",

0 commit comments

Comments
 (0)