From 86bee52361d5626fab80770b5a31dffb80a51cb1 Mon Sep 17 00:00:00 2001 From: Skydust Date: Sun, 22 Dec 2024 12:49:16 +0100 Subject: [PATCH] first commit --- .gitignore | 0 README.md | 2 ++ action.yml | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 action.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md new file mode 100644 index 0000000..2b4208f --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# docker-login-skydust + diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..0c2ee62 --- /dev/null +++ b/action.yml @@ -0,0 +1,43 @@ +name: Install node packages +description: An action to install node packages, no matter the package manager +author: Skydust + +# Define your inputs here. +inputs: + path: + description: The package path + required: false + default: "." + +runs: + using: composite + steps: + - name: Installing package manager + shell: sh + run: | + cd "${{ inputs.path }}" + if ! corepack install; then + log_info "$(blue)Finding out the package manager used" + + PKG_MANAGER="npm" + if [ -f "./package-lock.json" ]; then + PKG_MANAGER="npm" + elif [ -f "./pnpm-lock.yaml" ]; then + PKG_MANAGER="pnpm" + elif [ -f "./.yarnrc.yml" ]; then + PKG_MANAGER="yarn" + elif [ -f "./yarn.lock ]; then + PKG_MANAGER="yarn@1" + fi + + log_info "$(blue)Using $PKG_MANAGER" + corepack use "$PKG_MANAGER" + fi + - name: Installing packages + shell: sh + run: | + cd "${{ inputs.path }}" + + PKG_MANAGER="$(sed -nE 's/.*"packageManager": *"([^@"]+).*/\1/p' package.json)" + log_info "$(blue)Installing with ${PKG_MANAGER}" + corepack "${PKG_MANAGER}" install