First commitfirst commit
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.idea
|
||||||
48
action.yml
Normal file
48
action.yml
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
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
|
||||||
|
env
|
||||||
|
- 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 }}
|
||||||
Reference in New Issue
Block a user