diff --git a/.github/actions/publish-live-update/publish-live-update.mjs b/.github/actions/publish-live-update/publish-live-update.mjs index 60ce89d..67c7aee 100644 --- a/.github/actions/publish-live-update/publish-live-update.mjs +++ b/.github/actions/publish-live-update/publish-live-update.mjs @@ -18,8 +18,16 @@ export function parseArgs(argv) { const cli = (cliVersion) => `${CLI_PACKAGE}@${cliVersion}`; -export function bundleArgs({ cliVersion, inputPath, outputPath }) { - return [cli(cliVersion), 'apps:liveupdates:bundle', '--input-path', inputPath, '--output-path', outputPath, '--overwrite']; +export function bundleArgs({ cliVersion, inputPath, outputPath, bundlePath }) { + return [ + cli(cliVersion), + 'apps:liveupdates:bundle', + '--input-path', + inputPath, + '--output-path', + outputPath ?? bundlePath, + '--overwrite', + ]; } export function loginArgs({ cliVersion, token }) { diff --git a/.github/actions/publish-live-update/publish-live-update.spec.mjs b/.github/actions/publish-live-update/publish-live-update.spec.mjs index 02552a9..b77b195 100644 --- a/.github/actions/publish-live-update/publish-live-update.spec.mjs +++ b/.github/actions/publish-live-update/publish-live-update.spec.mjs @@ -131,7 +131,7 @@ describe('main', () => { deps: { argv: baseArgv, env: baseEnv, - run: (command, args) => calls.push({ type: 'run', command, subcommand: args[1] }), + run: (command, args) => calls.push({ type: 'run', command, args, subcommand: args[1] }), chdir: (path) => calls.push({ type: 'chdir', path }), writeKey: (path, key) => calls.push({ type: 'writeKey', path, key }), removeKey: (path) => calls.push({ type: 'removeKey', path }), @@ -152,6 +152,11 @@ describe('main', () => { 'run:apps:liveupdates:upload', 'removeKey', ]); + const bundleCall = calls.find((call) => call.subcommand === 'apps:liveupdates:bundle'); + expect(bundleCall.args[bundleCall.args.indexOf('--output-path') + 1]).toBe('bundle.zip'); + expect(bundleCall.args[bundleCall.args.indexOf('--input-path') + 1]).toBe('www/browser'); + const uploadCall = calls.find((call) => call.subcommand === 'apps:liveupdates:upload'); + expect(uploadCall.args[uploadCall.args.indexOf('--path') + 1]).toBe('bundle.zip'); expect(calls.find((call) => call.type === 'writeKey').path).toBe(PRIVATE_KEY_FILE); expect(calls.find((call) => call.type === 'removeKey').path).toBe(PRIVATE_KEY_FILE); });