diff --git a/.github/workflows/envtest.yml b/.github/workflows/envtest.yml index 82a18c7..445081f 100644 --- a/.github/workflows/envtest.yml +++ b/.github/workflows/envtest.yml @@ -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 diff --git a/actions/example-config-updater/action.yaml b/actions/example-config-updater/action.yaml index 29fa95f..b07af44 100644 --- a/actions/example-config-updater/action.yaml +++ b/actions/example-config-updater/action.yaml @@ -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 diff --git a/actions/example-config-updater/dist/index.js b/actions/example-config-updater/dist/index.js index 6a86821..4b02a69 100644 --- a/actions/example-config-updater/dist/index.js +++ b/actions/example-config-updater/dist/index.js @@ -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(); /***/ }), diff --git a/actions/example-config-updater/src/index.ts b/actions/example-config-updater/src/index.ts index c4a26bc..36444d5 100644 --- a/actions/example-config-updater/src/index.ts +++ b/actions/example-config-updater/src/index.ts @@ -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() \ No newline at end of file