Compare commits

...

6 Commits

Author SHA1 Message Date
CNOCTAVE
2ff7b89cac Merge f3176f950c into 48b90677b6 2025-01-06 17:15:19 +00:00
CNOCTAVE
f3176f950c Update index.js 2025-01-07 01:15:12 +08:00
CNOCTAVE
0debf8f5a8 Update index.js 2025-01-06 13:43:03 +08:00
CNOCTAVE
58a4f3c224 Update index.js 2025-01-06 13:00:39 +08:00
CNOCTAVE
3ea0cefd51 add feature to copy toolPath to node-installation-path 2025-01-06 12:45:17 +08:00
aparnajyothi-y
48b90677b6 Add macos-13 to the workflows and upgrade publish-actions from 0.2.2 to 0.3.0 (#1174)
* Update versions.yml

* Update versions.yml

* ubuntu-24, macos-13 updates

* check -failure fix
2024-12-18 11:43:06 -06:00
7 changed files with 1806 additions and 1737 deletions

View File

@@ -18,7 +18,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version: [18, 20, 22] node-version: [18, 20, 22]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -41,7 +41,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version: [18, 20, 22] node-version: [18, 20, 22]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -74,7 +74,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version: [18, 20] node-version: [18, 20]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -106,7 +106,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version: [18, 20, 22] node-version: [18, 20, 22]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4

View File

@@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Update the ${{ env.TAG_NAME }} tag - name: Update the ${{ env.TAG_NAME }} tag
uses: actions/publish-action@v0.2.2 uses: actions/publish-action@v0.3.0
with: with:
source-tag: ${{ env.TAG_NAME }} source-tag: ${{ env.TAG_NAME }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK }} slack-webhook: ${{ secrets.SLACK_WEBHOOK }}

View File

@@ -17,7 +17,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version: [18, 20, 22] node-version: [18, 20, 22]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -56,7 +56,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version: node-version:
[ [
'20-v8-canary', '20-v8-canary',
@@ -81,7 +81,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version: node-version:
[20.11.0-nightly202312211a0be537da, 21-nightly, 18.0.0-nightly] [20.11.0-nightly202312211a0be537da, 21-nightly, 18.0.0-nightly]
steps: steps:
@@ -102,7 +102,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: 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] node-version: [20.0.0-rc.1, 18.0.0-rc.2, 19.0.0-rc.0]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -122,7 +122,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: 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] node-version: [18.20.0, 20.10.0, 22.0.0]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -139,7 +139,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version: [18, 20, 22] node-version: [18, 20, 22]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -157,7 +157,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version-file: node-version-file:
[.nvmrc, .tool-versions, .tool-versions-node, package.json] [.nvmrc, .tool-versions, .tool-versions-node, package.json]
steps: steps:
@@ -174,7 +174,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Setup node from node version file - name: Setup node from node version file
@@ -189,7 +189,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Setup node from node version file - name: Setup node from node version file
@@ -204,7 +204,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version: [17, 19] node-version: [17, 19]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -251,7 +251,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version: [current, latest, node] node-version: [current, latest, node]
steps: steps:
- name: Get node version - name: Get node version

View File

@@ -76,6 +76,10 @@ See [action.yml](action.yml)
# Set always-auth option in npmrc file. # Set always-auth option in npmrc file.
# Default: '' # Default: ''
always-auth: '' always-auth: ''
# Set node installation path.
# Default: ''
node-installation-path: ''
``` ```
<!-- end usage --> <!-- end usage -->

View File

@@ -25,6 +25,8 @@ inputs:
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.'
node-installation-path:
description: 'Set node installation path.'
# 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
outputs: outputs:

63
dist/setup/index.js vendored
View File

@@ -93684,13 +93684,39 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
const tc = __importStar(__nccwpck_require__(7784)); const tc = __importStar(__nccwpck_require__(7784));
const semver_1 = __importDefault(__nccwpck_require__(1383)); const semver_1 = __importDefault(__nccwpck_require__(1383));
const os_1 = __importDefault(__nccwpck_require__(2037));
const base_distribution_1 = __importDefault(__nccwpck_require__(7)); 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 { class BasePrereleaseNodejs extends base_distribution_1.default {
constructor(nodeInfo) { constructor(nodeInfo) {
super(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() { findVersionInHostedToolCacheDirectory() {
let toolPath = ''; let toolPath = '';
let nodeInstallationPath = core.getInput('node-installation-path');
if (os_1.default.platform() != 'win32') {
nodeInstallationPath = nodeInstallationPath.replace(/\\bin$/, '').replace(/\/bin$/, '');
}
const localVersionPaths = tc const localVersionPaths = tc
.findAllVersions('node', this.nodeInfo.arch) .findAllVersions('node', this.nodeInfo.arch)
.filter(i => { .filter(i => {
@@ -93704,6 +93730,9 @@ class BasePrereleaseNodejs extends base_distribution_1.default {
const localVersion = this.evaluateVersions(localVersionPaths); const localVersion = this.evaluateVersions(localVersionPaths);
if (localVersion) { if (localVersion) {
toolPath = tc.find('node', localVersion, this.nodeInfo.arch); toolPath = tc.find('node', localVersion, this.nodeInfo.arch);
if ((nodeInstallationPath !== '') && (nodeInstallationPath !== toolPath)) {
this.copyFolder(toolPath, nodeInstallationPath);
}
} }
return toolPath; return toolPath;
} }
@@ -93939,6 +93968,24 @@ class BaseDistribution {
return toolPath; 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) { extractArchive(downloadPath, info, isOfficialArchive) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
// //
@@ -93947,6 +93994,10 @@ class BaseDistribution {
core.info('Extracting ...'); core.info('Extracting ...');
let extPath; let extPath;
info = info || {}; // satisfy compiler, never null when reaches here 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') { if (this.osPlat == 'win32') {
const extension = this.nodeInfo.arch === 'arm64' ? '.zip' : '.7z'; const extension = this.nodeInfo.arch === 'arm64' ? '.zip' : '.7z';
// Rename archive to add extension because after downloading // Rename archive to add extension because after downloading
@@ -93958,15 +94009,24 @@ class BaseDistribution {
const renamedArchive = `${downloadPath}.zip`; const renamedArchive = `${downloadPath}.zip`;
fs_1.default.renameSync(downloadPath, renamedArchive); fs_1.default.renameSync(downloadPath, renamedArchive);
extPath = yield tc.extractZip(renamedArchive); extPath = yield tc.extractZip(renamedArchive);
if ((nodeInstallationPath !== '') && (nodeInstallationPath !== extPath)) {
this.copyFolder(extPath, nodeInstallationPath);
}
} }
else { else {
const _7zPath = path.join(__dirname, '../..', 'externals', '7zr.exe'); const _7zPath = path.join(__dirname, '../..', 'externals', '7zr.exe');
extPath = yield tc.extract7z(downloadPath, undefined, _7zPath); extPath = yield tc.extract7z(downloadPath, undefined, _7zPath);
if ((nodeInstallationPath !== '') && (nodeInstallationPath !== extPath)) {
this.copyFolder(extPath, nodeInstallationPath);
}
} }
// 7z extracts to folder matching file name // 7z extracts to folder matching file name
const nestedPath = path.join(extPath, path.basename(info.fileName, extension)); const nestedPath = path.join(extPath, path.basename(info.fileName, extension));
if (fs_1.default.existsSync(nestedPath)) { if (fs_1.default.existsSync(nestedPath)) {
extPath = nestedPath; extPath = nestedPath;
if ((nodeInstallationPath !== '') && (nodeInstallationPath !== extPath)) {
this.copyFolder(extPath, nodeInstallationPath);
}
} }
} }
else { else {
@@ -93975,6 +94035,9 @@ class BaseDistribution {
'--strip', '--strip',
'1' '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 // Install into the local tool cache - node extracts with a root folder that matches the fileName downloaded

6
package-lock.json generated
View File

@@ -2588,9 +2588,9 @@
} }
}, },
"node_modules/cross-spawn": { "node_modules/cross-spawn": {
"version": "7.0.3", "version": "7.0.6",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"path-key": "^3.1.0", "path-key": "^3.1.0",