Skip to content

Commit

Permalink
consume --ref param
Browse files Browse the repository at this point in the history
  • Loading branch information
abe-winter committed Dec 19, 2023
1 parent 3d40197 commit 3d24e1d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 25 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@ jobs:
## Build commands
## Auth instructions
## Examples
- ...
4 changes: 3 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 8 additions & 12 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
20 changes: 8 additions & 12 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3d24e1d

Please sign in to comment.