mirror of
https://github.com/actions/setup-node.git
synced 2026-06-20 14:33:48 +08:00
Compare commits
6 Commits
v4.1.0
...
2ff7b89cac
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ff7b89cac | ||
|
|
f3176f950c | ||
|
|
0debf8f5a8 | ||
|
|
58a4f3c224 | ||
|
|
3ea0cefd51 | ||
|
|
48b90677b6 |
8
.github/workflows/e2e-cache.yml
vendored
8
.github/workflows/e2e-cache.yml
vendored
@@ -18,7 +18,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
||||
node-version: [18, 20, 22]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -41,7 +41,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
||||
node-version: [18, 20, 22]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -74,7 +74,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
||||
node-version: [18, 20]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -106,7 +106,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
||||
node-version: [18, 20, 22]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -22,7 +22,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Update the ${{ env.TAG_NAME }} tag
|
||||
uses: actions/publish-action@v0.2.2
|
||||
uses: actions/publish-action@v0.3.0
|
||||
with:
|
||||
source-tag: ${{ env.TAG_NAME }}
|
||||
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
|
||||
|
||||
22
.github/workflows/versions.yml
vendored
22
.github/workflows/versions.yml
vendored
@@ -17,7 +17,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
||||
node-version: [18, 20, 22]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -56,7 +56,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
||||
node-version:
|
||||
[
|
||||
'20-v8-canary',
|
||||
@@ -81,7 +81,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
||||
node-version:
|
||||
[20.11.0-nightly202312211a0be537da, 21-nightly, 18.0.0-nightly]
|
||||
steps:
|
||||
@@ -102,7 +102,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
||||
node-version: [20.0.0-rc.1, 18.0.0-rc.2, 19.0.0-rc.0]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -122,7 +122,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
||||
node-version: [18.20.0, 20.10.0, 22.0.0]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -139,7 +139,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
||||
node-version: [18, 20, 22]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -157,7 +157,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
||||
node-version-file:
|
||||
[.nvmrc, .tool-versions, .tool-versions-node, package.json]
|
||||
steps:
|
||||
@@ -174,7 +174,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup node from node version file
|
||||
@@ -189,7 +189,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup node from node version file
|
||||
@@ -204,7 +204,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
||||
node-version: [17, 19]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -251,7 +251,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
||||
node-version: [current, latest, node]
|
||||
steps:
|
||||
- name: Get node version
|
||||
|
||||
@@ -76,6 +76,10 @@ See [action.yml](action.yml)
|
||||
# Set always-auth option in npmrc file.
|
||||
# Default: ''
|
||||
always-auth: ''
|
||||
|
||||
# Set node installation path.
|
||||
# Default: ''
|
||||
node-installation-path: ''
|
||||
```
|
||||
<!-- end usage -->
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ inputs:
|
||||
description: 'Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm.'
|
||||
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.'
|
||||
node-installation-path:
|
||||
description: 'Set node installation path.'
|
||||
# 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
|
||||
outputs:
|
||||
|
||||
63
dist/setup/index.js
vendored
63
dist/setup/index.js
vendored
@@ -93684,13 +93684,39 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
const tc = __importStar(__nccwpck_require__(7784));
|
||||
const semver_1 = __importDefault(__nccwpck_require__(1383));
|
||||
const os_1 = __importDefault(__nccwpck_require__(2037));
|
||||
const base_distribution_1 = __importDefault(__nccwpck_require__(7));
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||
const path = __importStar(__nccwpck_require__(1017));
|
||||
class BasePrereleaseNodejs extends base_distribution_1.default {
|
||||
constructor(nodeInfo) {
|
||||
super(nodeInfo);
|
||||
}
|
||||
copyFolder(srcDir, destDir) {
|
||||
if (!fs_1.default.existsSync(destDir)) {
|
||||
fs_1.default.mkdirSync(destDir, { recursive: true });
|
||||
}
|
||||
|
||||
fs_1.default.readdirSync(srcDir).forEach(file => {
|
||||
const srcFile = path.join(srcDir, file);
|
||||
const destFile = path.join(destDir, file);
|
||||
|
||||
const stat = fs_1.default.statSync(srcFile);
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
copyFolder(srcFile, destFile);
|
||||
} else if (stat.isFile()) {
|
||||
fs_1.default.copyFileSync(srcFile, destFile);
|
||||
}
|
||||
});
|
||||
}
|
||||
findVersionInHostedToolCacheDirectory() {
|
||||
let toolPath = '';
|
||||
let nodeInstallationPath = core.getInput('node-installation-path');
|
||||
if (os_1.default.platform() != 'win32') {
|
||||
nodeInstallationPath = nodeInstallationPath.replace(/\\bin$/, '').replace(/\/bin$/, '');
|
||||
}
|
||||
const localVersionPaths = tc
|
||||
.findAllVersions('node', this.nodeInfo.arch)
|
||||
.filter(i => {
|
||||
@@ -93704,6 +93730,9 @@ class BasePrereleaseNodejs extends base_distribution_1.default {
|
||||
const localVersion = this.evaluateVersions(localVersionPaths);
|
||||
if (localVersion) {
|
||||
toolPath = tc.find('node', localVersion, this.nodeInfo.arch);
|
||||
if ((nodeInstallationPath !== '') && (nodeInstallationPath !== toolPath)) {
|
||||
this.copyFolder(toolPath, nodeInstallationPath);
|
||||
}
|
||||
}
|
||||
return toolPath;
|
||||
}
|
||||
@@ -93939,6 +93968,24 @@ class BaseDistribution {
|
||||
return toolPath;
|
||||
});
|
||||
}
|
||||
copyFolder(srcDir, destDir) {
|
||||
if (!fs_1.default.existsSync(destDir)) {
|
||||
fs_1.default.mkdirSync(destDir, { recursive: true });
|
||||
}
|
||||
|
||||
fs_1.default.readdirSync(srcDir).forEach(file => {
|
||||
const srcFile = path.join(srcDir, file);
|
||||
const destFile = path.join(destDir, file);
|
||||
|
||||
const stat = fs_1.default.statSync(srcFile);
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
copyFolder(srcFile, destFile);
|
||||
} else if (stat.isFile()) {
|
||||
fs_1.default.copyFileSync(srcFile, destFile);
|
||||
}
|
||||
});
|
||||
}
|
||||
extractArchive(downloadPath, info, isOfficialArchive) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
//
|
||||
@@ -93947,6 +93994,10 @@ class BaseDistribution {
|
||||
core.info('Extracting ...');
|
||||
let extPath;
|
||||
info = info || {}; // satisfy compiler, never null when reaches here
|
||||
let nodeInstallationPath = core.getInput('node-installation-path');
|
||||
if (this.osPlat != 'win32') {
|
||||
nodeInstallationPath = nodeInstallationPath.replace(/\\bin$/, '').replace(/\/bin$/, '');
|
||||
}
|
||||
if (this.osPlat == 'win32') {
|
||||
const extension = this.nodeInfo.arch === 'arm64' ? '.zip' : '.7z';
|
||||
// Rename archive to add extension because after downloading
|
||||
@@ -93958,15 +94009,24 @@ class BaseDistribution {
|
||||
const renamedArchive = `${downloadPath}.zip`;
|
||||
fs_1.default.renameSync(downloadPath, renamedArchive);
|
||||
extPath = yield tc.extractZip(renamedArchive);
|
||||
if ((nodeInstallationPath !== '') && (nodeInstallationPath !== extPath)) {
|
||||
this.copyFolder(extPath, nodeInstallationPath);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const _7zPath = path.join(__dirname, '../..', 'externals', '7zr.exe');
|
||||
extPath = yield tc.extract7z(downloadPath, undefined, _7zPath);
|
||||
if ((nodeInstallationPath !== '') && (nodeInstallationPath !== extPath)) {
|
||||
this.copyFolder(extPath, nodeInstallationPath);
|
||||
}
|
||||
}
|
||||
// 7z extracts to folder matching file name
|
||||
const nestedPath = path.join(extPath, path.basename(info.fileName, extension));
|
||||
if (fs_1.default.existsSync(nestedPath)) {
|
||||
extPath = nestedPath;
|
||||
if ((nodeInstallationPath !== '') && (nodeInstallationPath !== extPath)) {
|
||||
this.copyFolder(extPath, nodeInstallationPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -93975,6 +94035,9 @@ class BaseDistribution {
|
||||
'--strip',
|
||||
'1'
|
||||
]);
|
||||
if ((nodeInstallationPath !== '') && (nodeInstallationPath !== extPath)) {
|
||||
this.copyFolder(extPath, nodeInstallationPath);
|
||||
}
|
||||
}
|
||||
//
|
||||
// Install into the local tool cache - node extracts with a root folder that matches the fileName downloaded
|
||||
|
||||
6
package-lock.json
generated
6
package-lock.json
generated
@@ -2588,9 +2588,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"path-key": "^3.1.0",
|
||||
|
||||
Reference in New Issue
Block a user