Difference between revisions of "Uses: actions/setup-node"

From wikieduonline
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{lc}}
 
{{lc}}
 
https://github.com/actions/setup-node
 
https://github.com/actions/setup-node
* Optionally downloading and caching distribution of the requested [[Node.js]] [[node --version|version]], and adding it to the PATH
+
* Optionally downloading and caching distribution of the requested [[Node.js]] [[node --version|version]], and adding it to the <code>[[PATH]]</code>
* Optionally caching npm/yarn/pnpm dependencies
+
* Optionally caching npm/yarn/[[pnpm]] dependencies
 
* Registering problem matchers for error output
 
* Registering problem matchers for error output
 
* Configuring authentication for [[GPR]] or [[npm]]
 
* Configuring authentication for [[GPR]] or [[npm]]
  
 +
[[actions/]]setup-node@v4
 
  [[actions/]][email protected]
 
  [[actions/]][email protected]
  
Line 65: Line 66:
 
* {{uses}}
 
* {{uses}}
 
* {{node}}
 
* {{node}}
 +
 +
 +
[[Category:GitHub Actions]]
 +
[[Category:Nodejs]]

Latest revision as of 15:38, 18 February 2024

https://github.com/actions/setup-node

  • Optionally downloading and caching distribution of the requested Node.js version, and adding it to the PATH
  • Optionally caching npm/yarn/pnpm dependencies
  • Registering problem matchers for error output
  • Configuring authentication for GPR or npm
actions/setup-node@v4
actions/setup[email protected]


Run actions/setup-node@v3
Found in cache @ /opt/hostedtoolcache/node/14.21.3/x64
Environment details
  node: v14.21.3
  npm: 6.14.18
  yarn: 1.22.19
/opt/hostedtoolcache/node/14.21.3/x64/bin/npm config get cache
/home/runner/.npm
npm cache is not found


Official example[edit]

# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests 
across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js CI

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

jobs:
  build:

    runs-on: ubuntu-latest 
    strategy:
      matrix:
        node-version: [14.x, 16.x, 18.x]
       # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
    steps:
    - uses: actions/checkout@v3
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v3
      with:
        node-version: ${{ matrix.node-version }}
        cache: 'npm'
    - run: npm ci
    - run: npm run build --if-present
    - run: npm test

Related[edit]

See also[edit]

Advertising: