diff --git a/README.md b/README.md index 2775644..af84e5d 100644 --- a/README.md +++ b/README.md @@ -41,3 +41,7 @@ jobs: ## Build commands ## Auth instructions + +## Examples + +- ... diff --git a/action.yml b/action.yml index 479f9da..ef8aa89 100644 --- a/action.yml +++ b/action.yml @@ -12,7 +12,9 @@ inputs: description: secret value of your auth key required: true version: - description: version to set for the module. if missing, your module will build but not upload + description: Version to set for the module. If missing, your module will build but not upload. + ref: + description: The git ref to build. This will usually be a sha, but can be a branch or anything supported by git checkout. runs: using: node20 diff --git a/dist/index.js b/dist/index.js index d755770..5cb2719 100644 --- a/dist/index.js +++ b/dist/index.js @@ -26258,27 +26258,23 @@ function parseBuildId(stdout) { (async function () { const args = util.parseArgs(argsConfig); const slug = archSlug(); - console.log('inferred architecture', slug); if (!args.values['skip-download']) { await download(`https://storage.googleapis.com/packages.viam.com/apps/viam-cli/viam-cli-${args.values['cli-channel']}-${slug}`, cliPath); - console.log('downloaded CLI'); + console.log('downloaded CLI for', args.values['cli-channel'], slug); } checkSpawnSync(spawnSync(cliPath, ['version'])); - const inputs = { - keyId: getInput('key-id'), - keyValue: getInput('key-value'), - version: getInput('version'), - ref: getInput('ref'), - }; if (!args.values['skip-login']) { - checkSpawnSync(spawnSync(cliPath, ['login', 'api-key', '--key-id', inputs.keyId, '--key', inputs.keyValue])); + checkSpawnSync(spawnSync(cliPath, ['login', 'api-key', '--key-id', getInput('key-id'), '--key', getInput('key-value')])); } const config = { - ref: inputs.ref || '', - version: inputs.version || '', + ref: getInput('ref') || '', + version: getInput('version') || '', } console.log('I will run with', config); - const startArgs = ['module', 'build', 'start', '--version', config.version]; // , '--ref', config.ref]; + const startArgs = ['module', 'build', 'start', '--version', config.version]; + if (config.ref) { + startArgs.push('--ref', config.ref); + } const spawnRet = spawnSync(cliPath, startArgs); checkSpawnSync(spawnRet); const buildId = parseBuildId(spawnRet.stdout); diff --git a/src/index.js b/src/index.js index 7f1167e..8b60619 100644 --- a/src/index.js +++ b/src/index.js @@ -84,27 +84,23 @@ function parseBuildId(stdout) { (async function () { const args = util.parseArgs(argsConfig); const slug = archSlug(); - console.log('inferred architecture', slug); if (!args.values['skip-download']) { await download(`https://storage.googleapis.com/packages.viam.com/apps/viam-cli/viam-cli-${args.values['cli-channel']}-${slug}`, cliPath); - console.log('downloaded CLI'); + console.log('downloaded CLI for', args.values['cli-channel'], slug); } checkSpawnSync(spawnSync(cliPath, ['version'])); - const inputs = { - keyId: getInput('key-id'), - keyValue: getInput('key-value'), - version: getInput('version'), - ref: getInput('ref'), - }; if (!args.values['skip-login']) { - checkSpawnSync(spawnSync(cliPath, ['login', 'api-key', '--key-id', inputs.keyId, '--key', inputs.keyValue])); + checkSpawnSync(spawnSync(cliPath, ['login', 'api-key', '--key-id', getInput('key-id'), '--key', getInput('key-value')])); } const config = { - ref: inputs.ref || '', - version: inputs.version || '', + ref: getInput('ref') || '', + version: getInput('version') || '', } console.log('I will run with', config); - const startArgs = ['module', 'build', 'start', '--version', config.version]; // , '--ref', config.ref]; + const startArgs = ['module', 'build', 'start', '--version', config.version]; + if (config.ref) { + startArgs.push('--ref', config.ref); + } const spawnRet = spawnSync(cliPath, startArgs); checkSpawnSync(spawnRet); const buildId = parseBuildId(spawnRet.stdout);