-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yaml
88 lines (77 loc) · 2.86 KB
/
action.yaml
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: 'Setup Node environment'
author: 'Exlint'
description: 'Installing NodeJS, package manager, setting a cache and install dependencies'
inputs:
should-cache:
description: 'Whether caching is enabled'
required: false
default: 'true'
node-version:
description: 'Version of NodeJS to use'
required: false
default: latest
package-manager:
description: 'Which package manager should be used'
required: false
default: npm
package-manager-version:
description: 'Version of package-manager to use'
required: false
default: latest
sub-modules:
description: >
Whether to checkout submodules: `true` to checkout submodules or `recursive` to
recursively checkout submodules.
When the `ssh-key` input is not provided, SSH URLs beginning with `[email protected]:` are
converted to HTTPS.
required: false
default: 'false'
runs:
using: 'composite'
steps:
- name: Check package manager
if: inputs.package-manager != 'npm' && inputs.package-manager != 'yarn' && inputs.package-manager != 'pnpm'
uses: actions/github-script@v7
with:
script: |
core.setFailed('Package manager must be either "npm", "yarn" or "pnpm"')
- name: Checkout
uses: actions/checkout@v4
with:
submodules: ${{ inputs.sub-modules }}
- name: Install pnpm
if: inputs.package-manager == 'pnpm'
uses: pnpm/action-setup@v2
with:
version: ${{ inputs.package-manager-version }}
- name: Setup Node.js
if: ${{ inputs.should-cache == 'false' }}
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
- name: Setup Node.js
if: ${{ inputs.should-cache == 'true' }}
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: ${{ inputs.package-manager }}
- name: Install npm
if: inputs.package-manager == 'npm'
run: npm i -g npm@${{ inputs.package-manager-version }}
shell: bash
- name: Install yarn
if: inputs.package-manager == 'yarn'
run: yarn set version ${{ inputs.package-manager-version }}
shell: bash
- name: Installing dependencies
if: inputs.package-manager == 'npm'
run: npm ci
shell: bash
- name: Installing dependencies
if: inputs.package-manager == 'yarn'
run: yarn install --immutable --immutable-cache --check-cache
shell: bash
- name: Installing dependencies
if: inputs.package-manager == 'pnpm'
run: pnpm i --frozen-lockfile --prefer-offline
shell: bash