From d70eb13e2da6721c5738484886d8e46fc1328420 Mon Sep 17 00:00:00 2001 From: Gio Gutierrez Date: Thu, 17 Oct 2024 05:35:11 -0500 Subject: [PATCH] feat: Add the option to specify the registry dir --- README.md | 7 ++++--- action.yml | 4 ++++ src/index.ts | 8 +++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e7b23ba..ec55714 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ jobs: ## Inputs -| Input | Default | Description | -| -------- | ------- | ------------------------------------------- | -| `crates` | N/A | A glob expression for the crates to publish | +| Input | Default | Description | +| ---------- | ------- | ------------------------------------------- | +| `crates` | N/A | A glob expression for the crates to publish | +| `registry` | `'.'` | The path to the Margo registry directory | diff --git a/action.yml b/action.yml index fb0f54c..348d8c6 100644 --- a/action.yml +++ b/action.yml @@ -8,6 +8,10 @@ inputs: description: "The GitHub token to use" required: true default: "gh-pages" + registry-dir: + description: "The directory to publish the registry to" + required: false + default: "." runs: using: "node20" main: "dist/main/index.js" diff --git a/src/index.ts b/src/index.ts index 6903213..3dbfefc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -52,6 +52,7 @@ async function ensureStaticRegistryTool() { async function run() { let cratePathsPattern = actions.getInput("crates"); + let registryDir = actions.getInput("registry-dir"); let cratePathsGlob = await glob.create(cratePathsPattern, { matchDirectories: false, }); @@ -64,7 +65,12 @@ async function run() { await actions.group("Publish code to registry", async () => { for (const cratePath of cratePaths) { - await exec.getExecOutput("margo", ["add", "--registry", ".", cratePath]); + await exec.getExecOutput("margo", [ + "add", + "--registry", + registryDir, + cratePath, + ]); } }); }