From 881171c8b0616d4436de802461762b84863ed7e4 Mon Sep 17 00:00:00 2001 From: chrisdca Date: Sun, 26 Oct 2025 20:37:46 -0500 Subject: [PATCH] update actions directory --- .../composite-workflow/action.yml | 0 .github/actions/my-cli-action/action.yml | 12 ++++++++++ .github/actions/my-cli-action/index.js | 20 ++++++++++++++++ .github/workflows/test-cli.yml | 24 +++++++++++++++++++ .github/workflows/workflow-ci.yml | 2 +- 5 files changed, 57 insertions(+), 1 deletion(-) rename .github/{workflows/utilities => actions}/composite-workflow/action.yml (100%) create mode 100644 .github/actions/my-cli-action/action.yml create mode 100644 .github/actions/my-cli-action/index.js create mode 100644 .github/workflows/test-cli.yml diff --git a/.github/workflows/utilities/composite-workflow/action.yml b/.github/actions/composite-workflow/action.yml similarity index 100% rename from .github/workflows/utilities/composite-workflow/action.yml rename to .github/actions/composite-workflow/action.yml diff --git a/.github/actions/my-cli-action/action.yml b/.github/actions/my-cli-action/action.yml new file mode 100644 index 0000000..f582e98 --- /dev/null +++ b/.github/actions/my-cli-action/action.yml @@ -0,0 +1,12 @@ +name: "Setup MyCLI" +description: "Installs MyCLI and adds it to the PATH" +author: "Christianncode" + +inputs: + version: + description: "The CLI version to install" + required: false + default: "latest" +runs: + using: "node16" + main: "index.js" diff --git a/.github/actions/my-cli-action/index.js b/.github/actions/my-cli-action/index.js new file mode 100644 index 0000000..0e20125 --- /dev/null +++ b/.github/actions/my-cli-action/index.js @@ -0,0 +1,20 @@ +const core = require("@actions/core"); +const {execSync} = require("child_process"); + +async function run() { + try { + const version = core.getInput("version") || "latest"; + + console.log(`Installing MyCLI version: ${version}...`); + + execSync(`curl -fsSL https://cli.example.com/install.sh | sh`, { + stdio: "inherit", + }); + + console.log("MyCLI installed successfully."); + } catch (error) { + core.setFailed(`Installation failed: ${error.message}`); + } +} + +run(); diff --git a/.github/workflows/test-cli.yml b/.github/workflows/test-cli.yml new file mode 100644 index 0000000..0a68761 --- /dev/null +++ b/.github/workflows/test-cli.yml @@ -0,0 +1,24 @@ +name: Test MyCLI Setup + +on: + push: + branches: + - main + - feature/* + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install MyCLI + uses: ./.github/actions/my-cli-action + with: + version: "1.2.3" + + - name: Verify CLI Installation + run: | + echo "Checking MyCLI version..." + mycli --version diff --git a/.github/workflows/workflow-ci.yml b/.github/workflows/workflow-ci.yml index 184b869..8737cf5 100644 --- a/.github/workflows/workflow-ci.yml +++ b/.github/workflows/workflow-ci.yml @@ -15,7 +15,7 @@ jobs: uses: actions/checkout@v4 - name: Call Greeting Workflow - uses: ./.github/workflows/utilities/composite-workflow + uses: ./.github/actions/composite-workflow with: name: "Environment: ${{ vars.ENVIRONMENT_NAME }}" message: "Hola"