astro/.github/actions/install/action.yml
Michael Rienstra d7b27a17e3
GitHub Actions: add install action (#5196)
* GitHub Actions: add install action
to reduce duplication

* debug, temp

* expect strings
add warnings

* minor, consistency

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
2022-10-28 12:40:03 -04:00

49 lines
1.3 KiB
YAML

name: Install Tools & Dependencies
description: Installs pnpm, JS runtime & package dependencies
inputs:
node-version:
description: 'Node version'
required: false
default: '16'
js-runtime:
description: 'JS runtime'
required: false
default: 'node'
install-dependencies:
description: 'Install dependencies'
required: false
default: 'true'
runs:
using: composite
steps:
- name: Check inputs.js-runtime
if: ${{ !contains(fromJson('["node", "deno"]'), inputs.js-runtime) }}
run: echo "::warning::unknown 'js-runtime' value '${{ inputs.js-runtime }}'"
shell: bash
- name: Check inputs.install-dependencies
if: ${{ !contains(fromJson('["true", "false"]'), inputs.install-dependencies) }}
run: echo "::warning::unknown 'install-dependencies' value '${{ inputs.install-dependencies }}'"
shell: bash
- name: Setup pnpm
uses: pnpm/action-setup@v2.2.4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}
cache: pnpm
- name: Use Deno
if: ${{ inputs.js-runtime == 'deno' }}
uses: denoland/setup-deno@v1
with:
deno-version: v1.26.1
- name: Install dependencies
if: ${{ fromJSON(inputs.install-dependencies) }}
run: pnpm install
shell: bash