forked from angular-schule/ngx-deploy-starter
-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
action.yml
51 lines (47 loc) · 1.71 KB
/
action.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
name: Setup
description: Setup Node.js, cache and install dependencies
inputs:
node-version:
description: 'The Node.js version to use. The default one is going to be the defined on the .nvmrc file.'
required: false
git_bot_token:
description: Git Bot token used to push to protected branches because github token can't
required: false
runs:
using: composite
steps:
- name: Checkout all commits
uses: actions/checkout@v4
with:
token: ${{ inputs.git_bot_token || github.token }}
fetch-depth: 0
- name: git config
shell: bash
run: |
git config user.name "ngx-deploy-npm Bot"
git config user.email "-"
- name: Set Node.js version based on .nvmrc or Action Input
shell: bash
run: |
if [ -z "${{ inputs.node-version }}" ]; then
version=$(cat .nvmrc)
echo "Setting default value for node-version parameter: $version"
echo "NODE_VERSION=$version" >> $GITHUB_ENV
else
echo "Using provided value for node-version parameter: ${{ inputs.node-version }}"
echo "NODE_VERSION=${{ inputs.node-version }}" >> $GITHUB_ENV
fi
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
# This doesn't just set the registry url, but also sets
# the right configuration in .npmrc that reads NPM token
# from NPM_AUTH_TOKEN environment variable.
# It actually creates a .npmrc in a temporary folder
# and sets the NPM_CONFIG_USERCONFIG environment variable.
registry-url: https://registry.npmjs.org
- name: npm install
shell: bash
run: npm ci