Skip to content

Commit

Permalink
add run() to make it actually work
Browse files Browse the repository at this point in the history
  • Loading branch information
mcascone committed Aug 13, 2024
1 parent dda73f0 commit 578a627
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/envtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:
run: |
echo 'config: ${{ steps.config.outputs.config }}'
echo 'art: ${{ steps.config.outputs.artifactId }}'
echo 'test: ${{ steps.config.outputs.test }}'
echo "env: $ARTIFACT_ID"
# linux_job:
# name: Linux Job
Expand Down
3 changes: 3 additions & 0 deletions actions/example-config-updater/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ outputs:
artifactId:
description: the updated config object as an artifact.

test:
description: test output

runs:
using: node20
main: dist/index.js
11 changes: 7 additions & 4 deletions actions/example-config-updater/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,20 @@ function run() {
const artifactClient = new artifact_1.DefaultArtifactClient();
const artifactName = "config";
const files = ["config.json"];
const rootDirectory = ".";
const uploadResponse = yield artifactClient.uploadArtifact(artifactName, files, rootDirectory);
console.log(`Created artifact with id: ${uploadResponse.id} (bytes: ${uploadResponse.size}`);
const { id, size } = yield artifactClient.uploadArtifact(artifactName, files, './');
console.log(`Created artifact with id: ${id} (bytes: ${size})`);
console.log('config: ', config);
core.setOutput("artifactId", uploadResponse.id);
core.setOutput("artifactId", id);
core.setOutput("config", JSON.stringify(config));
core.setOutput("test", "this is a test");
core.exportVariable("ARTIFACT_ID", id);
}
catch (error) {
core.setFailed(error.message);
}
});
}
run();


/***/ }),
Expand Down
22 changes: 12 additions & 10 deletions actions/example-config-updater/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,25 @@ async function run() {
const artifactClient = new DefaultArtifactClient();
const artifactName = "config";
const files = ["config.json"];
const rootDirectory = ".";

const uploadResponse = await artifactClient.uploadArtifact(
artifactName,
files,
rootDirectory,
);
const {id, size} = await artifactClient.uploadArtifact(artifactName, files, './')

console.log(
`Created artifact with id: ${uploadResponse.id} (bytes: ${uploadResponse.size}`,
);
console.log(`Created artifact with id: ${id} (bytes: ${size})`)

console.log('config: ', config)

core.setOutput("artifactId", uploadResponse.id);
core.setOutput("artifactId", id)

core.setOutput("config", JSON.stringify(config))

core.setOutput("test", "this is a test")

core.exportVariable("ARTIFACT_ID", id)

} catch (error) {
core.setFailed(error.message);
}
}


run()

0 comments on commit 578a627

Please sign in to comment.