-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (51 loc) · 1.59 KB
/
environment-setup.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
"on":
workflow_call:
inputs:
package_manager:
default: npm
description: Package manager to use. Can be 'npm' or 'bun'
type: string
dependencies_type:
default: prod
description: Dependencies type to install. Can be 'prod' or 'dev'
type: string
node_version:
description: Node version to setup
default: "18"
required: false
type: string
registry_url:
description: Registry url to use
default: https://registry.npmjs.org
required: false
type: string
jobs:
setup-npm:
if: inputs.package_manager == 'npm'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
registry-url: ${{ inputs.registry_url }}
node-version: ${{ inputs.node_version }}
cache: npm
- name: Install node dependencies
run: npm ci ${{ inputs.dependencies_type == 'prod' && '--omit=dev' || '' }}
setup-bun:
if: inputs.package_manager == 'bun'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
registry-url: ${{ inputs.registry_url }}
node-version: ${{ inputs.node_version }}
- uses: oven-sh/setup-bun@v1
- uses: actions/cache@v2
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
- name: Install node dependencies
run: bun install --frozen-lockfile ${{ inputs.dependencies_type == 'prod' && '--production' || '' }}