commit ac29df7e0c388321d1f14a54966c0d4cfc915b75 Author: Skydust Date: Sun Dec 22 12:49:16 2024 +0100 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..485dee6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea 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..766feda --- /dev/null +++ b/action.yml @@ -0,0 +1,47 @@ +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: "." + options: + description: Package manager options + 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 ${{ inputs.options }}