Compare commits

..

20 Commits

Author SHA1 Message Date
17f8bd9264 Expand current syntax to support aliases for latest version (current/latest/node) (#483) 2022-05-12 17:26:02 +02:00
b067f78ed3 Use CI friendly commands in documentation (#326) 2022-05-05 16:16:51 +02:00
0bd06765ef Improve advanced usage docs (#472) 2022-05-01 16:59:15 +02:00
25184c4485 Update README.md (#475)
* Update README.md

* Update README.md
2022-04-26 11:11:03 -04:00
337fdf2194 fix broken link in readme (#473)
* fix broken link

* fix broken link
2022-04-22 08:58:19 -04:00
86bf502a33 extend documentation on scope parameter (#470)
This also ends all descriptions with a full stop (`.`).
2022-04-19 13:43:19 -04:00
146c4d84a5 improve caching documentation (#468) 2022-04-18 16:15:27 +02:00
56337c4255 Updated @actions/cache (#460)
* Updated @actions/cache

* Licensed cache

* new build

* Updated version
2022-04-11 19:06:18 +05:30
76d3665dc0 Convert CONDUCT to CODE_OF_CONDUCT.md (#391)
* Rename CONDUCT to CODE_OF_CONDUCT.md

* Update CODE_OF_CONDUCT link
2022-04-05 11:16:57 -04:00
5b52f097d3 Bump actions/checkout@v3 within advanced usage examples documentation (#456) 2022-04-01 10:41:49 +02:00
75716637dc Bump to actions/checkout@v3 (#437) 2022-04-01 10:13:52 +02:00
546fd45825 Updated documentation/workflows to use actions/setup-node@v3 (#433)
* Update documentation `actions/setup-node@v2` -> `actions/setup-node@v3`

* Bump workflows to `actions/setup-node@v3`

* Update `README.md` workflow status badges to new format
2022-03-31 15:14:07 -04:00
bacd6b4b3a Caching on GHES (#452)
* add support for ghes caching

* fix licesnses

* work on resolving comments

* change internal error to warning

* fix warning for internal errors

* update version
2022-03-31 15:10:37 -04:00
bed538bd04 Merge pull request #448 from actions/dependabot/npm_and_yarn/minimist-1.2.6
Bump minimist from 1.2.5 to 1.2.6
2022-03-24 09:33:20 -04:00
f3e93d1b9d Bump minimist from 1.2.5 to 1.2.6
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-24 11:54:46 +00:00
ed960c9656 Merge pull request #440 from actions/joshmgross/service-codeowners
Update CODEOWNERS to actions-service
2022-03-10 13:32:59 -05:00
77f43a4400 Update CODEOWNERS to actions-service 2022-03-10 13:27:02 -05:00
9ced9a43a2 remove version input (#424) 2022-02-24 16:31:57 +03:00
3e90744edf Update lockfileVersion (#422) 2022-02-24 14:42:19 +03:00
28df918a56 Update default runtime to node16 (#414) 2022-02-22 11:28:24 +03:00
37 changed files with 21531 additions and 9888 deletions

View File

@ -18,13 +18,13 @@ jobs:
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Setup node 16 - name: Setup Node 16.x
uses: actions/setup-node@v2 uses: actions/setup-node@v3
with: with:
node-version: 16.x node-version: 16.x
cache: npm cache: npm
- run: npm ci - run: npm ci
- run: npm run build - run: npm run build
- run: npm run format-check - run: npm run format-check
- run: npm test - run: npm test

View File

@ -21,10 +21,10 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Set Node.js 16.x - name: Setup Node 16.x
uses: actions/setup-node@v2 uses: actions/setup-node@v3
with: with:
node-version: 16.x node-version: 16.x
cache: npm cache: npm
@ -45,7 +45,7 @@ jobs:
id: diff id: diff
# If index.js was different than expected, upload the expected version as an artifact # If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v3
if: ${{ failure() && steps.diff.conclusion == 'failure' }} if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with: with:
name: dist name: dist

View File

@ -10,7 +10,7 @@ on:
- releases/* - releases/*
paths-ignore: paths-ignore:
- '**.md' - '**.md'
jobs: jobs:
node-npm-depencies-caching: node-npm-depencies-caching:
name: Test npm (Node ${{ matrix.node-version}}, ${{ matrix.os }}) name: Test npm (Node ${{ matrix.node-version}}, ${{ matrix.os }})
@ -21,7 +21,7 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [12, 14, 16] node-version: [12, 14, 16]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Clean global cache - name: Clean global cache
run: npm cache clean --force run: npm cache clean --force
- name: Setup Node - name: Setup Node
@ -44,7 +44,7 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [12, 14, 16] node-version: [12, 14, 16]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Install pnpm - name: Install pnpm
uses: pnpm/action-setup@v2 uses: pnpm/action-setup@v2
with: with:
@ -77,7 +77,7 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [12, 14, 16] node-version: [12, 14, 16]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Yarn version - name: Yarn version
run: yarn --version run: yarn --version
- name: Generate yarn file - name: Generate yarn file
@ -109,7 +109,7 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [12, 14, 16] node-version: [12, 14, 16]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Update yarn - name: Update yarn
run: yarn set version berry run: yarn set version berry
- name: Yarn version - name: Yarn version

View File

@ -13,12 +13,12 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: Check licenses name: Check licenses
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- run: npm ci - run: npm ci
- name: Install licensed - name: Install licensed
run: | run: |
cd $RUNNER_TEMP cd $RUNNER_TEMP
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.3.1/licensed-3.3.1-linux-x64.tar.gz curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.4.4/licensed-3.4.4-linux-x64.tar.gz
sudo tar -xzf licensed.tar.gz sudo tar -xzf licensed.tar.gz
sudo mv licensed /usr/local/bin/licensed sudo mv licensed /usr/local/bin/licensed
- run: licensed status - run: licensed status

View File

@ -25,7 +25,7 @@ jobs:
env: env:
https_proxy: http://squid-proxy:3128 https_proxy: http://squid-proxy:3128
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Clear tool cache - name: Clear tool cache
run: rm -rf $RUNNER_TOOL_CACHE/* run: rm -rf $RUNNER_TOOL_CACHE/*
- name: Setup node 14 - name: Setup node 14
@ -41,7 +41,7 @@ jobs:
https_proxy: http://no-such-proxy:3128 https_proxy: http://no-such-proxy:3128
no_proxy: api.github.com,github.com,nodejs.org,registry.npmjs.org,*.s3.amazonaws.com,s3.amazonaws.com no_proxy: api.github.com,github.com,nodejs.org,registry.npmjs.org,*.s3.amazonaws.com,s3.amazonaws.com
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Clear tool cache - name: Clear tool cache
run: rm -rf $RUNNER_TOOL_CACHE/* run: rm -rf $RUNNER_TOOL_CACHE/*
- name: Setup node 11 - name: Setup node 11

View File

@ -3,14 +3,14 @@ name: versions
on: on:
pull_request: pull_request:
paths-ignore: paths-ignore:
- '**.md' - '**.md'
push: push:
branches: branches:
- main - main
- releases/* - releases/*
paths-ignore: paths-ignore:
- '**.md' - '**.md'
jobs: jobs:
local-cache: local-cache:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@ -20,7 +20,7 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [10, 12, 14] node-version: [10, 12, 14]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Setup Node - name: Setup Node
uses: ./ uses: ./
with: with:
@ -37,7 +37,7 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [lts/dubnium, lts/erbium, lts/fermium, lts/*] node-version: [lts/dubnium, lts/erbium, lts/fermium, lts/*]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Setup Node - name: Setup Node
uses: ./ uses: ./
with: with:
@ -51,7 +51,7 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [10.15, 12.16.0, 14.2.0, 16.3.0] node-version: [10.15, 12.16.0, 14.2.0, 16.3.0]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Setup Node - name: Setup Node
uses: ./ uses: ./
with: with:
@ -68,7 +68,7 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [10, 12, 14] node-version: [10, 12, 14]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Setup Node and check latest - name: Setup Node and check latest
uses: ./ uses: ./
with: with:
@ -85,7 +85,7 @@ jobs:
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Setup node from node version file - name: Setup node from node version file
uses: ./ uses: ./
with: with:
@ -101,7 +101,7 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [11, 13] node-version: [11, 13]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Setup Node from dist - name: Setup Node from dist
uses: ./ uses: ./
with: with:
@ -117,7 +117,7 @@ jobs:
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
# test old versions which didn't have npm and layout different # test old versions which didn't have npm and layout different
- name: Setup node 0.12.18 from dist - name: Setup node 0.12.18 from dist
uses: ./ uses: ./
@ -130,7 +130,7 @@ jobs:
arch: arch:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Setup node 14 x86 from dist - name: Setup node 14 x86 from dist
uses: ./ uses: ./
with: with:
@ -139,3 +139,34 @@ jobs:
- name: Verify node - name: Verify node
run: __tests__/verify-arch.sh "ia32" run: __tests__/verify-arch.sh "ia32"
shell: bash shell: bash
node-latest-aliases:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [current, latest, node]
steps:
- name: Get node version
run: |
latestNodeVersion=$(curl https://nodejs.org/dist/index.json | jq -r '. [0].version')
echo "::set-output name=LATEST_NODE_VERSION::$latestNodeVersion"
id: version
shell: bash
- uses: actions/checkout@v3
- name: Setup Node
uses: ./
with:
node-version: ${{ matrix.node-version }}
- name: Retrieve version after install
run: |
updatedVersion=$(echo $(node --version))
echo "::set-output name=NODE_VERSION_UPDATED::$updatedVersion"
id: updatedVersion
shell: bash
- name: Compare versions
if: ${{ steps.version.outputs.LATEST_NODE_VERSION != steps.updatedVersion.outputs.NODE_VERSION_UPDATED}}
run: |
echo "Latest node version failed to download."
exit 1

View File

@ -1,6 +1,6 @@
--- ---
name: "@actions/cache" name: "@actions/cache"
version: 1.0.8 version: 2.0.2
type: npm type: npm
summary: Actions cache lib summary: Actions cache lib
homepage: https://github.com/actions/toolkit/tree/main/packages/cache homepage: https://github.com/actions/toolkit/tree/main/packages/cache

View File

@ -1,32 +0,0 @@
---
name: "@actions/http-client"
version: 1.0.8
type: npm
summary: Actions Http Client
homepage: https://github.com/actions/http-client#readme
license: mit
licenses:
- sources: LICENSE
text: |
Actions Http Client for Node.js
Copyright (c) GitHub, Inc.
All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
notices: []

View File

@ -1,32 +1,32 @@
--- ---
name: "@azure/core-asynciterator-polyfill" name: "@azure/core-asynciterator-polyfill"
version: 1.0.0 version: 1.0.2
type: npm type: npm
summary: Polyfill for IE/Node 8 for Symbol.asyncIterator summary: Polyfill for IE/Node 8 for Symbol.asyncIterator
homepage: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/core/core-asynciterator-polyfill homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/core-asynciterator-polyfill/README.md
license: mit license: mit
licenses: licenses:
- sources: LICENSE - sources: LICENSE
text: |2 text: |
MIT License The MIT License (MIT)
Copyright (c) Microsoft Corporation. All rights reserved. Copyright (c) 2020 Microsoft
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software. copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE SOFTWARE.
notices: [] notices: []

View File

@ -1,6 +1,6 @@
--- ---
name: "@azure/core-http" name: "@azure/core-http"
version: 2.2.2 version: 2.2.4
type: npm type: npm
summary: Isomorphic client Runtime for Typescript/node.js/browser javascript client summary: Isomorphic client Runtime for Typescript/node.js/browser javascript client
libraries generated using AutoRest libraries generated using AutoRest

View File

@ -1,6 +1,6 @@
--- ---
name: "@azure/core-lro" name: "@azure/core-lro"
version: 2.2.1 version: 2.2.4
type: npm type: npm
summary: Isomorphic client library for supporting long-running operations in node.js summary: Isomorphic client library for supporting long-running operations in node.js
and browser. and browser.

View File

@ -1,6 +1,6 @@
--- ---
name: "@azure/core-paging" name: "@azure/core-paging"
version: 1.2.0 version: 1.2.1
type: npm type: npm
summary: Core types for paging async iterable iterators summary: Core types for paging async iterable iterators
homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/core-paging/README.md homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/core-paging/README.md

View File

@ -1,6 +1,6 @@
--- ---
name: "@azure/ms-rest-js" name: "@azure/ms-rest-js"
version: 2.6.0 version: 2.6.1
type: npm type: npm
summary: Isomorphic client Runtime for Typescript/node.js/browser javascript client summary: Isomorphic client Runtime for Typescript/node.js/browser javascript client
libraries generated using AutoRest libraries generated using AutoRest

View File

@ -1,6 +1,6 @@
--- ---
name: "@azure/storage-blob" name: "@azure/storage-blob"
version: 12.8.0 version: 12.9.0
type: npm type: npm
summary: Microsoft Azure Storage SDK for JavaScript - Blob summary: Microsoft Azure Storage SDK for JavaScript - Blob
homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/storage-blob/ homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/storage-blob/

View File

@ -1,6 +1,6 @@
--- ---
name: "@opentelemetry/api" name: "@opentelemetry/api"
version: 1.0.3 version: 1.0.4
type: npm type: npm
summary: Public API for OpenTelemetry summary: Public API for OpenTelemetry
homepage: https://github.com/open-telemetry/opentelemetry-js-api#readme homepage: https://github.com/open-telemetry/opentelemetry-js-api#readme
@ -218,10 +218,6 @@ licenses:
[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions [discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
[license-url]: https://github.com/open-telemetry/opentelemetry-js-api/blob/main/LICENSE [license-url]: https://github.com/open-telemetry/opentelemetry-js-api/blob/main/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat [license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[dependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js-api.svg
[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js-api
[devDependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js-api.svg?type=dev
[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js-api?type=dev
[npm-url]: https://www.npmjs.com/package/@opentelemetry/api [npm-url]: https://www.npmjs.com/package/@opentelemetry/api
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fapi.svg [npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fapi.svg
[docs-tracing]: https://github.com/open-telemetry/opentelemetry-js-api/blob/main/docs/tracing.md [docs-tracing]: https://github.com/open-telemetry/opentelemetry-js-api/blob/main/docs/tracing.md

View File

@ -1,6 +1,6 @@
--- ---
name: "@types/node-fetch" name: "@types/node-fetch"
version: 2.5.12 version: 2.6.1
type: npm type: npm
summary: TypeScript definitions for node-fetch summary: TypeScript definitions for node-fetch
homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-fetch homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-fetch

View File

@ -1,26 +1,32 @@
--- ---
name: "@types/node" name: "@types/node"
version: 12.0.10 version: 16.11.25
type: npm type: npm
summary: TypeScript definitions for Node.js summary: TypeScript definitions for Node.js
homepage: https://github.com/DefinitelyTyped/DefinitelyTyped#readme homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node
license: mit license: mit
licenses: licenses:
- sources: LICENSE - sources: LICENSE
text: " MIT License\r\n\r\n Copyright (c) Microsoft Corporation. All rights text: |2
reserved.\r\n\r\n Permission is hereby granted, free of charge, to any person MIT License
obtaining a copy\r\n of this software and associated documentation files (the
\"Software\"), to deal\r\n in the Software without restriction, including without Copyright (c) Microsoft Corporation.
limitation the rights\r\n to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell\r\n copies of the Software, and to permit persons to Permission is hereby granted, free of charge, to any person obtaining a copy
whom the Software is\r\n furnished to do so, subject to the following conditions:\r\n\r\n of this software and associated documentation files (the "Software"), to deal
\ The above copyright notice and this permission notice shall be included in in the Software without restriction, including without limitation the rights
all\r\n copies or substantial portions of the Software.\r\n\r\n THE SOFTWARE to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n IMPLIED, copies of the Software, and to permit persons to whom the Software is
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n FITNESS furnished to do so, subject to the following conditions:
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n LIABILITY, The above copyright notice and this permission notice shall be included in all
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n OUT copies or substantial portions of the Software.
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n
\ SOFTWARE\r\n" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
notices: [] notices: []

View File

@ -1,6 +1,6 @@
--- ---
name: node-fetch name: node-fetch
version: 2.6.1 version: 2.6.7
type: npm type: npm
summary: A light-weight module that brings window.fetch to node.js summary: A light-weight module that brings window.fetch to node.js
homepage: https://github.com/bitinn/node-fetch homepage: https://github.com/bitinn/node-fetch

View File

@ -1,9 +1,9 @@
--- ---
name: "@actions/core" name: tr46
version: 1.2.4 version: 0.0.3
type: npm type: npm
summary: Actions core lib summary: An implementation of the Unicode TR46 spec
homepage: https://github.com/actions/toolkit/tree/master/packages/core homepage: https://github.com/Sebmaster/tr46.js#readme
license: mit license: mit
licenses: licenses:
- sources: Auto-generated MIT license text - sources: Auto-generated MIT license text

23
.licenses/npm/webidl-conversions.dep.yml generated Normal file
View File

@ -0,0 +1,23 @@
---
name: webidl-conversions
version: 3.0.1
type: npm
summary: Implements the WebIDL algorithms for converting to and from JavaScript values
homepage:
license: bsd-2-clause
licenses:
- sources: LICENSE.md
text: |
# The BSD 2-Clause License
Copyright (c) 2014, Domenic Denicola
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
notices: []

32
.licenses/npm/whatwg-url.dep.yml generated Normal file
View File

@ -0,0 +1,32 @@
---
name: whatwg-url
version: 5.0.0
type: npm
summary: An implementation of the WHATWG URL Standard's URL API and parsing machinery
homepage:
license: mit
licenses:
- sources: LICENSE.txt
text: |
The MIT License (MIT)
Copyright (c) 20152016 Sebastian Mayr
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
notices: []

View File

@ -1 +1 @@
* @actions/spark * @actions/actions-service

View File

@ -1,8 +1,8 @@
# setup-node # setup-node
<p align="left"> [![build-test](https://github.com/actions/setup-node/actions/workflows/build-test.yml/badge.svg)](https://github.com/actions/setup-node/actions/workflows/build-test.yml)
<a href="https://github.com/actions/setup-node/actions?query=workflow%3Abuild-test"><img alt="build-test status" src="https://github.com/actions/setup-node/workflows/build-test/badge.svg"></a> <a href="https://github.com/actions/setup-node/actions?query=workflow%3Aversions"><img alt="versions status" src="https://github.com/actions/setup-node/workflows/versions/badge.svg"></a> <a href="https://github.com/actions/setup-node/actions?query=workflow%3Aproxy"><img alt="proxy status" src="https://github.com/actions/setup-node/workflows/proxy/badge.svg"></a> [![versions](https://github.com/actions/setup-node/actions/workflows/versions.yml/badge.svg)](https://github.com/actions/setup-node/actions/workflows/versions.yml)
</p> [![proxy](https://github.com/actions/setup-node/actions/workflows/proxy.yml/badge.svg)](https://github.com/actions/setup-node/actions/workflows/proxy.yml)
This action provides the following functionality for GitHub Actions users: This action provides the following functionality for GitHub Actions users:
@ -11,104 +11,119 @@ This action provides the following functionality for GitHub Actions users:
- Registering problem matchers for error output - Registering problem matchers for error output
- Configuring authentication for GPR or npm - Configuring authentication for GPR or npm
# Usage ## Usage
See [action.yml](action.yml) See [action.yml](action.yml)
**Basic:** **Basic:**
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: actions/setup-node@v2 - uses: actions/setup-node@v3
with: with:
node-version: '14' node-version: 14
- run: npm install - run: npm ci
- run: npm test - run: npm test
``` ```
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 the system one. 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 the 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 ### Supported version syntax
The `node-version` input supports the following syntax: The `node-version` input supports the following syntax:
major versions: `12`, `14`, `16` major versions: `12`, `14`, `16`
more specific versions: `10.15`, `14.2.0`, `16.3.0` more specific versions: `10.15`, `14.2.0`, `16.3.0`
nvm lts syntax: `lts/erbium`, `lts/fermium`, `lts/*` nvm lts syntax: `lts/erbium`, `lts/fermium`, `lts/*`
latest release: `latest`/`current`/`node`
## Caching packages dependencies **Note:** Since the latest release will not be cached always, there is possibility of hitting rate limit when downloading from dist
The action has a built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/cache) under the hood for caching dependencies but requires less configuration settings. Supported package managers are `npm`, `yarn`, `pnpm` (v6.10+). The `cache` input is optional, and caching is turned off by default. ### Checking in lockfiles
It's **always** recommended to commit the lockfile of your package manager for security and performance reasons. For more information consult the "Working with lockfiles" section of the [Advanced usage](docs/advanced-usage.md#working-with-lockfiles) guide.
## Caching global packages data
The action has a built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/cache) under the hood for caching global packages data but requires less configuration settings. Supported package managers are `npm`, `yarn`, `pnpm` (v6.10+). The `cache` input is optional, and caching is turned off by default.
The action defaults to search for the dependency file (`package-lock.json` or `yarn.lock`) in the repository root, and uses its hash as a part of the cache key. Use `cache-dependency-path` for cases when multiple dependency files are used, or they are located in different subdirectories. The action defaults to search for the dependency file (`package-lock.json` or `yarn.lock`) in the repository root, and uses its hash as a part of the cache key. Use `cache-dependency-path` for cases when multiple dependency files are used, or they are located in different subdirectories.
See the examples of using cache for `yarn` / `pnpm` and `cache-dependency-path` input in the [Advanced usage](docs/advanced-usage.md#caching-packages-dependencies) guide. **Note:** The action does not cache `node_modules`
See the examples of using cache for `yarn`/`pnpm` and `cache-dependency-path` input in the [Advanced usage](docs/advanced-usage.md#caching-packages-data) guide.
**Caching npm dependencies:** **Caching npm dependencies:**
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: actions/setup-node@v2 - uses: actions/setup-node@v3
with: with:
node-version: '14' node-version: 14
cache: 'npm' cache: 'npm'
- run: npm install - run: npm ci
- run: npm test - run: npm test
``` ```
**Caching npm dependencies in monorepos:** **Caching npm dependencies in monorepos:**
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: actions/setup-node@v2 - uses: actions/setup-node@v3
with: with:
node-version: '14' node-version: 14
cache: 'npm' cache: 'npm'
cache-dependency-path: subdir/package-lock.json cache-dependency-path: subdir/package-lock.json
- run: npm install - run: npm ci
- run: npm test - run: npm test
``` ```
## Matrix Testing: ## Matrix Testing
```yaml ```yaml
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
node: [ '12', '14', '16' ] node: [ 12, 14, 16 ]
name: Node ${{ matrix.node }} sample name: Node ${{ matrix.node }} sample
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Setup node - name: Setup node
uses: actions/setup-node@v2 uses: actions/setup-node@v3
with: with:
node-version: ${{ matrix.node }} node-version: ${{ matrix.node }}
- run: npm install - run: npm ci
- run: npm test - run: npm test
``` ```
## Advanced usage ## Advanced usage
1. [Check latest version](docs/advanced-usage.md#check-latest-version) 1. [Check latest version](docs/advanced-usage.md#check-latest-version)
2. [Using a node version file](docs/advanced-usage.md#node-version-file) 2. [Using a node version file](docs/advanced-usage.md#node-version-file)
3. [Using different architectures](docs/advanced-usage.md#architecture) 3. [Using different architectures](docs/advanced-usage.md#architecture)
4. [Caching packages dependencies](docs/advanced-usage.md#caching-packages-dependencies) 4. [Caching packages data](docs/advanced-usage.md#caching-packages-data)
5. [Using multiple operating systems and architectures](docs/advanced-usage.md#multiple-operating-systems-and-architectures) 5. [Using multiple operating systems and architectures](docs/advanced-usage.md#multiple-operating-systems-and-architectures)
6. [Publishing to npmjs and GPR with npm](docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-npm) 6. [Publishing to npmjs and GPR with npm](docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-npm)
7. [Publishing to npmjs and GPR with yarn](docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-yarn) 7. [Publishing to npmjs and GPR with yarn](docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-yarn)
8. [Using private packages](docs/advanced-usage.md#use-private-packages) 8. [Using private packages](docs/advanced-usage.md#use-private-packages)
# License ## License
The scripts and documentation in this project are released under the [MIT License](LICENSE) The scripts and documentation in this project are released under the [MIT License](LICENSE)
# Contributions ## Contributions
Contributions are welcome! See [Contributor's Guide](docs/contributors.md) Contributions are welcome! See [Contributor's Guide](docs/contributors.md)
## Code of Conduct ## Code of Conduct
:wave: Be nice. See [our code of conduct](CONDUCT) :wave: Be nice. See [our code of conduct](CODE_OF_CONDUCT.md)

View File

@ -1,37 +1,28 @@
import * as core from '@actions/core'; import * as core from '@actions/core';
import * as cache from '@actions/cache';
import path from 'path'; import path from 'path';
import * as utils from '../src/cache-utils'; import * as utils from '../src/cache-utils';
import {PackageManagerInfo} from '../src/cache-utils'; import {PackageManagerInfo, isCacheFeatureAvailable} from '../src/cache-utils';
describe('cache-utils', () => { describe('cache-utils', () => {
const commonPath = '/some/random/path';
const versionYarn1 = '1.2.3'; const versionYarn1 = '1.2.3';
const versionYarn2 = '2.3.4';
let debugSpy: jest.SpyInstance; let debugSpy: jest.SpyInstance;
let getCommandOutputSpy: jest.SpyInstance; let getCommandOutputSpy: jest.SpyInstance;
let isFeatureAvailable: jest.SpyInstance;
function getPackagePath(name: string) { let info: jest.SpyInstance;
if (name === utils.supportedPackageManagers.npm.getCacheFolderCommand) { let warningSpy: jest.SpyInstance;
return `${commonPath}/npm`;
} else if (
name === utils.supportedPackageManagers.pnpm.getCacheFolderCommand
) {
return `${commonPath}/pnpm`;
} else {
if (name === utils.supportedPackageManagers.yarn1.getCacheFolderCommand) {
return `${commonPath}/yarn1`;
} else {
return `${commonPath}/yarn2`;
}
}
}
beforeEach(() => { beforeEach(() => {
process.env['GITHUB_WORKSPACE'] = path.join(__dirname, 'data'); process.env['GITHUB_WORKSPACE'] = path.join(__dirname, 'data');
debugSpy = jest.spyOn(core, 'debug'); debugSpy = jest.spyOn(core, 'debug');
debugSpy.mockImplementation(msg => {}); debugSpy.mockImplementation(msg => {});
info = jest.spyOn(core, 'info');
warningSpy = jest.spyOn(core, 'warning');
isFeatureAvailable = jest.spyOn(cache, 'isFeatureAvailable');
getCommandOutputSpy = jest.spyOn(utils, 'getCommandOutput'); getCommandOutputSpy = jest.spyOn(utils, 'getCommandOutput');
}); });
@ -51,7 +42,32 @@ describe('cache-utils', () => {
}); });
}); });
it('isCacheFeatureAvailable for GHES is false', () => {
isFeatureAvailable.mockImplementation(() => false);
process.env['GITHUB_SERVER_URL'] = 'https://www.test.com';
expect(() => isCacheFeatureAvailable()).toThrowError(
'Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.'
);
});
it('isCacheFeatureAvailable for GHES has an interhal error', () => {
isFeatureAvailable.mockImplementation(() => false);
process.env['GITHUB_SERVER_URL'] = '';
isCacheFeatureAvailable();
expect(warningSpy).toHaveBeenCalledWith(
'The runner was not able to contact the cache service. Caching will be skipped'
);
});
it('isCacheFeatureAvailable for GHES is available', () => {
isFeatureAvailable.mockImplementation(() => true);
expect(isCacheFeatureAvailable()).toStrictEqual(true);
});
afterEach(() => { afterEach(() => {
process.env['GITHUB_SERVER_URL'] = '';
jest.resetAllMocks(); jest.resetAllMocks();
jest.clearAllMocks(); jest.clearAllMocks();
}); });

View File

@ -2,6 +2,7 @@ import * as core from '@actions/core';
import * as io from '@actions/io'; import * as io from '@actions/io';
import * as tc from '@actions/tool-cache'; import * as tc from '@actions/tool-cache';
import * as im from '../src/installer'; import * as im from '../src/installer';
import * as cache from '@actions/cache';
import fs from 'fs'; import fs from 'fs';
import cp from 'child_process'; import cp from 'child_process';
import osm = require('os'); import osm = require('os');
@ -36,6 +37,7 @@ describe('setup-node', () => {
let execSpy: jest.SpyInstance; let execSpy: jest.SpyInstance;
let authSpy: jest.SpyInstance; let authSpy: jest.SpyInstance;
let parseNodeVersionSpy: jest.SpyInstance; let parseNodeVersionSpy: jest.SpyInstance;
let isCacheActionAvailable: jest.SpyInstance;
beforeEach(() => { beforeEach(() => {
// @actions/core // @actions/core
@ -67,6 +69,9 @@ describe('setup-node', () => {
existsSpy = jest.spyOn(fs, 'existsSync'); existsSpy = jest.spyOn(fs, 'existsSync');
mkdirpSpy = jest.spyOn(io, 'mkdirP'); mkdirpSpy = jest.spyOn(io, 'mkdirP');
// @actions/tool-cache
isCacheActionAvailable = jest.spyOn(cache, 'isFeatureAvailable');
// disable authentication portion for installer tests // disable authentication portion for installer tests
authSpy = jest.spyOn(auth, 'configAuthentication'); authSpy = jest.spyOn(auth, 'configAuthentication');
authSpy.mockImplementation(() => {}); authSpy.mockImplementation(() => {});
@ -644,6 +649,49 @@ describe('setup-node', () => {
); );
}); });
}); });
describe('cache on GHES', () => {
it('Should throw an error, because cache is not supported', async () => {
inputs['node-version'] = '12';
inputs['cache'] = 'npm';
inSpy.mockImplementation(name => inputs[name]);
let toolPath = path.normalize('/cache/node/12.16.1/x64');
findSpy.mockImplementation(() => toolPath);
// expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
process.env['GITHUB_SERVER_URL'] = 'https://www.test.com';
isCacheActionAvailable.mockImplementation(() => false);
await main.run();
expect(cnSpy).toHaveBeenCalledWith(
`::error::Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.${osm.EOL}`
);
});
it('Should throw an internal error', async () => {
inputs['node-version'] = '12';
inputs['cache'] = 'npm';
inSpy.mockImplementation(name => inputs[name]);
let toolPath = path.normalize('/cache/node/12.16.1/x64');
findSpy.mockImplementation(() => toolPath);
// expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
process.env['GITHUB_SERVER_URL'] = '';
isCacheActionAvailable.mockImplementation(() => false);
await main.run();
expect(warningSpy).toHaveBeenCalledWith(
'The runner was not able to contact the cache service. Caching will be skipped'
);
});
});
describe('LTS version', () => { describe('LTS version', () => {
beforeEach(() => { beforeEach(() => {
os.platform = 'linux'; os.platform = 'linux';
@ -861,4 +909,30 @@ describe('setup-node', () => {
); );
}); });
}); });
describe('latest alias syntax', () => {
it.each(['latest', 'current', 'node'])(
'download the %s version if alias is provided',
async inputVersion => {
// Arrange
inputs['node-version'] = inputVersion;
os.platform = 'darwin';
os.arch = 'x64';
findSpy.mockImplementation(() => '');
getManifestSpy.mockImplementation(() => {
throw new Error('Unable to download manifest');
});
// Act
await main.run();
// assert
expect(logSpy).toHaveBeenCalledWith('Unable to download manifest');
expect(logSpy).toHaveBeenCalledWith('getting latest node version...');
}
);
});
}); });

View File

@ -1,39 +1,35 @@
name: 'Setup Node.js environment' name: 'Setup Node.js environment'
description: 'Setup a Node.js environment by adding problem matchers and optionally downloading and adding it to the PATH' description: 'Setup a Node.js environment by adding problem matchers and optionally downloading and adding it to the PATH.'
author: 'GitHub' author: 'GitHub'
inputs: inputs:
always-auth: always-auth:
description: 'Set always-auth in npmrc' description: 'Set always-auth in npmrc.'
default: 'false' default: 'false'
node-version: node-version:
description: 'Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0' description: 'Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0.'
node-version-file: node-version-file:
description: 'File containing the version Spec of the version to use. Examples: .nvmrc, .node-version' description: 'File containing the version Spec of the version to use. Examples: .nvmrc, .node-version.'
architecture: architecture:
description: 'Target architecture for Node to use. Examples: x86, x64. Will use system architecture by default.' description: 'Target architecture for Node to use. Examples: x86, x64. Will use system architecture by default.'
check-latest: check-latest:
description: 'Set this option if you want the action to check for the latest available version that satisfies the version spec' description: 'Set this option if you want the action to check for the latest available version that satisfies the version spec.'
default: false default: false
registry-url: registry-url:
description: 'Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN' description: 'Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN.'
scope: scope:
description: 'Optional scope for authenticating against scoped registries' description: 'Optional scope for authenticating against scoped registries. Will fall back to the repository owner when using the GitHub Packages registry (https://npm.pkg.github.com/).'
token: token:
description: Used to pull node distributions from node-versions. Since there's a default, this is typically not supplied by the user. description: Used to pull node distributions from node-versions. Since there's a default, this is typically not supplied by the user.
default: ${{ github.token }} default: ${{ github.token }}
cache: cache:
description: 'Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm' description: 'Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm.'
cache-dependency-path: cache-dependency-path:
description: 'Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies.' description: 'Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies.'
# TODO: add input to control forcing to pull from cloud or dist. # TODO: add input to control forcing to pull from cloud or dist.
# escape valve for someone having issues or needing the absolute latest which isn't cached yet # escape valve for someone having issues or needing the absolute latest which isn't cached yet
# Deprecated option, do not use. Will not be supported after October 1, 2019
version:
description: 'Deprecated. Use node-version instead. Will not be supported after October 1, 2019'
deprecationMessage: 'The version property will not be supported after October 1, 2019. Use node-version instead'
outputs: outputs:
cache-hit: cache-hit:
description: 'A boolean value to indicate if a cache was hit' description: 'A boolean value to indicate if a cache was hit.'
runs: runs:
using: 'node16' using: 'node16'
main: 'dist/setup/index.js' main: 'dist/setup/index.js'

16945
dist/cache-save/index.js vendored

File diff suppressed because one or more lines are too long

8557
dist/setup/index.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,38 @@
# Advanced usage ## Working with lockfiles
All supported package managers recommend that you **always** commit the lockfile, although implementations vary doing so generally provides the following benefits:
- Enables faster installation for CI and production environments, due to being able to skip package resolution.
- Describes a single representation of a dependency tree such that teammates, deployments, and continuous integration are guaranteed to install exactly the same dependencies.
- Provides a facility for users to "time-travel" to previous states of `node_modules` without having to commit the directory itself.
- Facilitates greater visibility of tree changes through readable source control diffs.
In order to get the most out of using your lockfile on continuous integration follow the conventions outlined below for your respective package manager.
### NPM
Ensure that `package-lock.json` is always committed, use `npm ci` instead of `npm install` when installing packages.
**See also:**
- [Documentation of `package-lock.json`](https://docs.npmjs.com/cli/v8/configuring-npm/package-lock-json)
- [Documentation of `npm ci`](https://docs.npmjs.com/cli/v8/commands/npm-ci)
### Yarn
Ensure that `yarn.lock` is always committed, pass `--frozen-lockfile` to `yarn install` when installing packages.
**See also:**
- [Documentation of `yarn.lock`](https://classic.yarnpkg.com/en/docs/yarn-lock)
- [Documentation of `--frozen-lockfile` option](https://classic.yarnpkg.com/en/docs/cli/install#toc-yarn-install-frozen-lockfile)
- [QA - Should lockfiles be committed to the repoistory?](https://yarnpkg.com/getting-started/qa/#should-lockfiles-be-committed-to-the-repository)
### PNPM
Ensure that `pnpm-lock.yaml` is always committed, when on CI pass `--frozen-lockfile` to `pnpm install` when installing packages.
**See also:**
- [Working with Git - Lockfiles](https://pnpm.io/git#lockfiles)
- [Documentation of `--frozen-lockfile` option](https://pnpm.io/cli/install#--frozen-lockfile)
## Check latest version ## Check latest version
@ -10,28 +44,28 @@ If `check-latest` is set to `true`, the action first checks if the cached versio
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: actions/setup-node@v2 - uses: actions/setup-node@v3
with: with:
node-version: '14' node-version: '14'
check-latest: true check-latest: true
- run: npm install - run: npm ci
- run: npm test - run: npm test
``` ```
## Node version file ## Node version file
The `node-version-file` input accepts a path to a file containing the version of Node.js to be used by a project, for example `.nvmrc` or `.node-version`. If both the `node-version` and the `node-version-file` inputs are provided then the `node-version` input is used. The `node-version-file` input accepts a path to a file containing the version of Node.js to be used by a project, for example `.nvmrc` or `.node-version`. If both the `node-version` and the `node-version-file` inputs are provided then the `node-version` input is used.
See [supported version syntax](https://github.com/actions/setup-node#supported-version-syntax) See [supported version syntax](https://github.com/actions/setup-node#supported-version-syntax)
> The action will search for the node version file relative to the repository root. > The action will search for the node version file relative to the repository root.
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: actions/setup-node@v2 - uses: actions/setup-node@v3
with: with:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
- run: npm install - run: npm ci
- run: npm test - run: npm test
``` ```
@ -46,28 +80,28 @@ jobs:
runs-on: windows-latest runs-on: windows-latest
name: Node sample name: Node sample
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: actions/setup-node@v2 - uses: actions/setup-node@v3
with: with:
node-version: '14' node-version: '14'
architecture: 'x64' # optional, x64 or x86. If not specified, x64 will be used by default architecture: 'x64' # optional, x64 or x86. If not specified, x64 will be used by default
- run: npm install - run: npm ci
- run: npm test - run: npm test
``` ```
## Caching packages dependencies ## Caching packages data
The action follows [actions/cache](https://github.com/actions/cache/blob/main/examples.md#node---npm) guidelines, and caches global cache on the machine instead of `node_modules`, so cache can be reused between different Node.js versions. The action follows [actions/cache](https://github.com/actions/cache/blob/main/examples.md#node---npm) guidelines, and caches global cache on the machine instead of `node_modules`, so cache can be reused between different Node.js versions.
**Caching yarn dependencies:** **Caching yarn dependencies:**
Yarn caching handles both yarn versions: 1 or 2. Yarn caching handles both yarn versions: 1 or 2.
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: actions/setup-node@v2 - uses: actions/setup-node@v3
with: with:
node-version: '14' node-version: '14'
cache: 'yarn' cache: 'yarn'
- run: yarn install - run: yarn install --frozen-lockfile
- run: yarn test - run: yarn test
``` ```
@ -81,43 +115,43 @@ steps:
# NOTE: pnpm caching support requires pnpm version >= 6.10.0 # NOTE: pnpm caching support requires pnpm version >= 6.10.0
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2 - uses: pnpm/action-setup@v2
with: with:
version: 6.10.0 version: 6.32.9
- uses: actions/setup-node@v2 - uses: actions/setup-node@v3
with: with:
node-version: '14' node-version: '14'
cache: 'pnpm' cache: 'pnpm'
- run: pnpm install - run: pnpm install --frozen-lockfile
- run: pnpm test - run: pnpm test
``` ```
**Using wildcard patterns to cache dependencies** **Using wildcard patterns to cache dependencies**
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: actions/setup-node@v2 - uses: actions/setup-node@v3
with: with:
node-version: '14' node-version: '14'
cache: 'npm' cache: 'npm'
cache-dependency-path: '**/package-lock.json' cache-dependency-path: '**/package-lock.json'
- run: npm install - run: npm ci
- run: npm test - run: npm test
``` ```
**Using a list of file paths to cache dependencies** **Using a list of file paths to cache dependencies**
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: actions/setup-node@v2 - uses: actions/setup-node@v3
with: with:
node-version: '14' node-version: '14'
cache: 'npm' cache: 'npm'
cache-dependency-path: | cache-dependency-path: |
server/app/package-lock.json server/app/package-lock.json
frontend/app/package-lock.json frontend/app/package-lock.json
- run: npm install - run: npm ci
- run: npm test - run: npm test
``` ```
@ -146,29 +180,29 @@ jobs:
architecture: x86 architecture: x86
name: Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }} name: Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Setup node - name: Setup node
uses: actions/setup-node@v2 uses: actions/setup-node@v3
with: with:
node-version: ${{ matrix.node_version }} node-version: ${{ matrix.node_version }}
architecture: ${{ matrix.architecture }} architecture: ${{ matrix.architecture }}
- run: npm install - run: npm ci
- run: npm test - run: npm test
``` ```
## Publish to npmjs and GPR with npm ## Publish to npmjs and GPR with npm
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: actions/setup-node@v2 - uses: actions/setup-node@v3
with: with:
node-version: '14.x' node-version: '14.x'
registry-url: 'https://registry.npmjs.org' registry-url: 'https://registry.npmjs.org'
- run: npm install - run: npm ci
- run: npm publish - run: npm publish
env: env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: actions/setup-node@v2 - uses: actions/setup-node@v3
with: with:
registry-url: 'https://npm.pkg.github.com' registry-url: 'https://npm.pkg.github.com'
- run: npm publish - run: npm publish
@ -179,16 +213,16 @@ steps:
## Publish to npmjs and GPR with yarn ## Publish to npmjs and GPR with yarn
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: actions/setup-node@v2 - uses: actions/setup-node@v3
with: with:
node-version: '14.x' node-version: '14.x'
registry-url: <registry url> registry-url: <registry url>
- run: yarn install - run: yarn install --frozen-lockfile
- run: yarn publish - run: yarn publish
env: env:
NODE_AUTH_TOKEN: ${{ secrets.YARN_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.YARN_TOKEN }}
- uses: actions/setup-node@v2 - uses: actions/setup-node@v3
with: with:
registry-url: 'https://npm.pkg.github.com' registry-url: 'https://npm.pkg.github.com'
- run: yarn publish - run: yarn publish
@ -199,14 +233,14 @@ steps:
## Use private packages ## Use private packages
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: actions/setup-node@v2 - uses: actions/setup-node@v3
with: with:
node-version: '14.x' node-version: '14.x'
registry-url: 'https://registry.npmjs.org' registry-url: 'https://registry.npmjs.org'
# Skip post-install scripts here, as a malicious # Skip post-install scripts here, as a malicious
# script could steal NODE_AUTH_TOKEN. # script could steal NODE_AUTH_TOKEN.
- run: npm install --ignore-scripts - run: npm ci --ignore-scripts
env: env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# `npm rebuild` will run all those post-install scripts for us. # `npm rebuild` will run all those post-install scripts for us.

5219
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "setup-node", "name": "setup-node",
"version": "2.0.0", "version": "3.1.1",
"private": true, "private": true,
"description": "setup node action", "description": "setup node action",
"main": "lib/setup-node.js", "main": "lib/setup-node.js",
@ -23,7 +23,7 @@
"author": "GitHub", "author": "GitHub",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/cache": "^1.0.8", "@actions/cache": "^2.0.2",
"@actions/core": "^1.6.0", "@actions/core": "^1.6.0",
"@actions/exec": "^1.1.0", "@actions/exec": "^1.1.0",
"@actions/github": "^1.1.0", "@actions/github": "^1.1.0",
@ -35,7 +35,7 @@
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^27.0.2", "@types/jest": "^27.0.2",
"@types/node": "^12.0.4", "@types/node": "^16.11.25",
"@types/semver": "^6.0.0", "@types/semver": "^6.0.0",
"@zeit/ncc": "^0.21.0", "@zeit/ncc": "^0.21.0",
"jest": "^27.2.5", "jest": "^27.2.5",

View File

@ -1,5 +1,6 @@
import * as core from '@actions/core'; import * as core from '@actions/core';
import * as exec from '@actions/exec'; import * as exec from '@actions/exec';
import * as cache from '@actions/cache';
type SupportedPackageManagers = { type SupportedPackageManagers = {
[prop: string]: PackageManagerInfo; [prop: string]: PackageManagerInfo;
@ -95,3 +96,28 @@ export const getCacheDirectoryPath = async (
return stdOut; return stdOut;
}; };
export function isGhes(): boolean {
const ghUrl = new URL(
process.env['GITHUB_SERVER_URL'] || 'https://github.com'
);
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
}
export function isCacheFeatureAvailable(): boolean {
if (!cache.isFeatureAvailable()) {
if (isGhes()) {
throw new Error(
'Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.'
);
} else {
core.warning(
'The runner was not able to contact the cache service. Caching will be skipped'
);
}
return false;
}
return true;
}

View File

@ -373,6 +373,15 @@ async function queryDistForMatch(
let versions: string[] = []; let versions: string[] = [];
let nodeVersions = await getVersionsFromDist(); let nodeVersions = await getVersionsFromDist();
if (
versionSpec === 'current' ||
versionSpec === 'latest' ||
versionSpec === 'node'
) {
core.info(`getting latest node version...`);
return nodeVersions[0].version;
}
nodeVersions.forEach((nodeVersion: INodeVersion) => { nodeVersions.forEach((nodeVersion: INodeVersion) => {
// ensure this version supports your os and platform // ensure this version supports your os and platform
if (nodeVersion.files.indexOf(dataFileName) >= 0) { if (nodeVersion.files.indexOf(dataFileName) >= 0) {

View File

@ -4,7 +4,7 @@ import fs from 'fs';
import * as auth from './authutil'; import * as auth from './authutil';
import * as path from 'path'; import * as path from 'path';
import {restoreCache} from './cache-restore'; import {restoreCache} from './cache-restore';
import {URL} from 'url'; import {isGhes, isCacheFeatureAvailable} from './cache-utils';
import os = require('os'); import os = require('os');
export async function run() { export async function run() {
@ -45,10 +45,7 @@ export async function run() {
auth.configAuthentication(registryUrl, alwaysAuth); auth.configAuthentication(registryUrl, alwaysAuth);
} }
if (cache) { if (cache && isCacheFeatureAvailable()) {
if (isGhes()) {
throw new Error('Caching is not supported on GHES');
}
const cacheDependencyPath = core.getInput('cache-dependency-path'); const cacheDependencyPath = core.getInput('cache-dependency-path');
await restoreCache(cache, cacheDependencyPath); await restoreCache(cache, cacheDependencyPath);
} }
@ -66,15 +63,8 @@ export async function run() {
} }
} }
function isGhes(): boolean {
const ghUrl = new URL(
process.env['GITHUB_SERVER_URL'] || 'https://github.com'
);
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
}
function resolveVersionInput(): string { function resolveVersionInput(): string {
let version = core.getInput('node-version') || core.getInput('version'); let version = core.getInput('node-version');
const versionFileInput = core.getInput('node-version-file'); const versionFileInput = core.getInput('node-version-file');
if (version && versionFileInput) { if (version && versionFileInput) {