Difference between revisions of "Uses: actions/setup-node"
Jump to navigation
Jump to search
Line 21: | Line 21: | ||
== Official example == | == Official example == | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | jobs: | + | # 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/ | # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | ||
− | + | <pre> | |
steps: | steps: | ||
- uses: actions/checkout@v3 | - uses: actions/checkout@v3 | ||
Line 54: | Line 55: | ||
- run: npm test | - run: npm test | ||
</pre> | </pre> | ||
− | |||
== Related == | == Related == |
Revision as of 14:56, 19 July 2023
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[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
# 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
- yarn
- Error: Cache folder path is retrieved for npm but doesn't exist on disk: /home/runner/.npm
- Error: Dependencies lock file is not found in
See also
npm
,npx
,npm [ init
|audit
|install
|link | config | token
|start | publish | run start
|update | rebuild
|ci
|run build
].env/
,list
|ls | --version
,package.json
,$HOME/.npmrc
,npm help
, NPM Registry, npm ERR!uses:, checkout@v3, configure-aws-credentials
- Node.js,
FROM node
,node (command)
node inspect
,nvm
,wait-on
,node -v
,node --help
,brew install node.js
,node-config
Advertising: