3
0
Fork 0
mirror of https://gitea.com/actions/setup-node.git synced 2024-11-25 11:39:32 +01:00

update readme

This commit is contained in:
Maxim Lobanov 2021-06-30 15:07:45 +03:00
parent e215578cb0
commit 40f85c8c97
6 changed files with 21 additions and 35 deletions

View file

@ -19,7 +19,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [10, 12, 14] node-version: [12, 14, 16]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Clean global cache - name: Clean global cache
@ -42,7 +42,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [10, 12, 14] node-version: [12, 14, 16]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Yarn version - name: Yarn version
@ -72,7 +72,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [10, 12, 14] node-version: [12, 14, 16]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Update yarn - name: Update yarn

View file

@ -30,12 +30,12 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Clear tool cache - name: Clear tool cache
run: rm -rf $RUNNER_TOOL_CACHE/* run: rm -rf $RUNNER_TOOL_CACHE/*
- name: Setup node 10 - name: Setup node 14
uses: ./ uses: ./
with: with:
node-version: 10.x node-version: 14.x
- name: Verify node and npm - name: Verify node and npm
run: __tests__/verify-node.sh 10 run: __tests__/verify-node.sh 14
test-bypass-proxy: test-bypass-proxy:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View file

@ -49,7 +49,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [10.15, 12.16.0, 14.2.0] node-version: [10.15, 12.16.0, 14.2.0, 16.3.0]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Setup Node - name: Setup Node
@ -66,7 +66,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [10, 11, 12, 14] node-version: [10, 12, 14]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Setup Node and check latest - name: Setup Node and check latest
@ -116,10 +116,10 @@ jobs:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Setup node 12 x86 from dist - name: Setup node 14 x86 from dist
uses: ./ uses: ./
with: with:
node-version: '12' node-version: '14'
architecture: 'x86' architecture: 'x86'
- name: Verify node - name: Verify node
run: __tests__/verify-arch.sh "ia32" run: __tests__/verify-arch.sh "ia32"

View file

@ -26,16 +26,24 @@ steps:
- run: npm test - run: npm test
``` ```
The `node-version` input is optional. If not supplied, the node version from PATH will be used. However, this action will still register problem matchers and support auth features. So setting up the node environment is still a valid scenario without downloading and caching versions. The `node-version` input is optional. If not supplied, the node version from PATH will be used. However, It is recommended to always specify Node.js version and don't rely on system one.
The action will first check the local cache for a semver match. If unable to find a specific version in the cache, the action will attempt to download a version of Node.js. It will pull LTS versions from [node-versions releases](https://github.com/actions/node-versions/releases) and on miss or failure will fall back to the previous behavior of downloading directly from [node dist](https://nodejs.org/dist/). The action will first check the local cache for a semver match. If unable to find a specific version in the cache, the action will attempt to download a version of Node.js. It will pull LTS versions from [node-versions releases](https://github.com/actions/node-versions/releases) and on miss or failure will fall back to the previous behavior of downloading directly from [node dist](https://nodejs.org/dist/).
For information regarding locally cached versions of Node.js on GitHub hosted runners, check out [GitHub Actions Virtual Environments](https://github.com/actions/virtual-environments). For information regarding locally cached versions of Node.js on GitHub hosted runners, check out [GitHub Actions Virtual Environments](https://github.com/actions/virtual-environments).
#### Supported version syntax
The `node-version` input supports the following syntax:
major versions: `12`, `14`, `16`
more specific versions: `10.15`, `14.2.0`, `16.3.0`
nvm lts syntax: `lts/erbium`, `lts/fermium`, `lts/*`
### Caching packages dependencies ### Caching packages dependencies
The action has a built-in functionality for caching and restoring npm/yarn dependencies. Supported package managers are `npm`, `yarn`. The `cache` input is optional, and caching is turned off by default. The action has a built-in functionality for caching and restoring npm/yarn dependencies. Supported package managers are `npm`, `yarn`. The `cache` input is optional, and caching is turned off by default.
**Caching npm dependencies:**
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -69,7 +77,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
node: [ '12', '14' ] node: [ '12', '14', '16' ]
name: Node ${{ matrix.node }} sample name: Node ${{ matrix.node }} sample
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View file

@ -52,9 +52,9 @@ jobs:
- macos-latest - macos-latest
- windows-latest - windows-latest
node_version: node_version:
- 10
- 12 - 12
- 14 - 14
- 16
architecture: architecture:
- x64 - x64
# an extra windows-x86 run: # an extra windows-x86 run:

View file

@ -1,22 +0,0 @@
#/bin/bash
set -e
rm -rf ./temp
rm -rf ./node
# uncomment to use charles proxy or other debugging proxy
# export NODE_TLS_REJECT_UNAUTHORIZED=0
# export https_proxy=http://127.0.0.1:8888
export RUNNER_TOOL_CACHE=$(pwd)
export RUNNER_TEMP="${RUNNER_TOOL_CACHE}/temp"
export INPUT_STABLE=true
export INPUT_VERSION="12" #"0.12.7" #"12" #"11.15.0"
# export your PAT with repo scope before running
export INPUT_TOKEN=$GITHUB_TOKEN
echo "Getting ${INPUT_VERSION} ($INPUT_STABLE) with ${INPUT_TOKEN}..."
node ../dist/index.js