Skip to content

Commit

Permalink
action.yml, try consuming
Browse files Browse the repository at this point in the history
  • Loading branch information
abe-winter committed Nov 17, 2023
1 parent 3d8408d commit c3a70d7
Show file tree
Hide file tree
Showing 7 changed files with 290 additions and 3 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/testme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
on:
push:

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./
with:
meta-path: test/meta.json
key-id: KEY ID
key-value: KEY VALUE
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
viam-cli
node_modules/
22 changes: 22 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Viam cloud build
description: Build and publish your Viam module on multiple platforms.

inputs:
meta-path:
description: location of module metadata. set to empty string to not use
default: meta.json
key-id:
description: ID of your auth key
required: true
key-value:
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

runs:
using: node20
main: 'src/index.js'

branding:
icon: upload-cloud
233 changes: 233 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"dependencies": {
"@actions/core": "^1.10.1",
"@actions/github": "^6.0.0"
}
}
1 change: 0 additions & 1 deletion src/.gitignore

This file was deleted.

16 changes: 14 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ const https = require('https');
const stream = require('node:stream/promises');
const util = require('node:util');
const execFileAsync = util.promisify(require('node:child_process').execFile);
const core = require('@actions/core');
const github = require('@actions/github');

const platforms = ['linux', 'darwin'];
const machines = {
Expand All @@ -22,7 +24,7 @@ const argsConfig = {
/** download a file and optionally set mode bits */
async function download(url, dest, mode = fs.constants.S_IRWXU) {
const output = fs.createWriteStream(dest);
const incoming = await new Promise(function(resolve, _reject) {
const incoming = await new Promise(function (resolve, _reject) {
https.get(url, (incoming) => resolve(incoming));
})
await stream.pipeline(incoming, output);
Expand All @@ -44,7 +46,7 @@ function archSlug() {
}

/** async main */
(async function() {
(async function () {
const args = util.parseArgs(argsConfig);
const slug = archSlug();
console.log('inferred architecture', slug);
Expand All @@ -53,6 +55,16 @@ function archSlug() {
console.log('downloaded CLI');
}
console.log((await execFileAsync(cliPath, ['version'])).stdout.trim());
const inputs = {
keyId: core.getInput('key-id'),
keyValue: core.getInput('key-value'),
version: core.getInput('version'),
};
console.log('I will run with', {
repo: `https://github.com/${github.context.repo.owner}/${github.context.repo.repo}`,
ref: github.context.ref,
version: inputs.version,
});
console.warn("TODO: start build");
console.warn("TODO: wait for build");
console.warn("TODO: show logs / status");
Expand Down

0 comments on commit c3a70d7

Please sign in to comment.