mirror of
https://github.com/actions/setup-node.git
synced 2024-12-23 00:58:42 +08:00
update readme and dist files
This commit is contained in:
parent
a869e7cc2d
commit
76a4cff9ae
44
README.md
44
README.md
|
@ -39,15 +39,13 @@ major versions: `12`, `14`, `16`
|
|||
more specific versions: `10.15`, `14.2.0`, `16.3.0`
|
||||
nvm lts syntax: `lts/erbium`, `lts/fermium`, `lts/*`
|
||||
|
||||
### Caching packages dependencies
|
||||
## Caching packages dependencies
|
||||
|
||||
The action has a built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/cache) under hood for caching dependencies but requires less configuration settings.
|
||||
The action has a built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/cache) under 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.
|
||||
|
||||
Supported package managers are `npm`, `yarn`, `pnpm`. 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 `cache-dependency-path` usage in the [Advanced usage](docs/advanced-usage.md#caching-packages-dependencies) guide.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
**Caching npm dependencies:**
|
||||
```yaml
|
||||
|
@ -61,42 +59,20 @@ steps:
|
|||
- run: npm test
|
||||
```
|
||||
|
||||
**Caching yarn dependencies:**
|
||||
**Caching npm dependencies in monorepos:**
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
cache: 'yarn'
|
||||
- run: yarn install
|
||||
- run: yarn test
|
||||
```
|
||||
Yarn caching handles both yarn versions: 1 or 2.
|
||||
|
||||
**Caching pnpm (v6.10+) dependencies:**
|
||||
```yaml
|
||||
# This workflow uses actions that are not certified by GitHub.
|
||||
# They are provided by a third-party and are governed by
|
||||
# separate terms of service, privacy policy, and support
|
||||
# documentation.
|
||||
|
||||
# NOTE: pnpm caching support requires pnpm version >= 6.10.0
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
|
||||
with:
|
||||
version: 6.10.0
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
cache: 'pnpm'
|
||||
- run: pnpm install
|
||||
- run: pnpm test
|
||||
cache: 'npm'
|
||||
cache-dependency-path: subdir/package-lock.json
|
||||
- run: npm install
|
||||
- run: npm test
|
||||
```
|
||||
|
||||
### Matrix Testing:
|
||||
## Matrix Testing:
|
||||
```yaml
|
||||
jobs:
|
||||
build:
|
||||
|
|
|
@ -22,7 +22,7 @@ inputs:
|
|||
cache:
|
||||
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 path to a dependencies file: package-lock.json, yarn.lock, etc. Supports wildcards or an array of file names.'
|
||||
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.
|
||||
# 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
|
||||
|
|
338
dist/cache-save/index.js
vendored
338
dist/cache-save/index.js
vendored
|
@ -4265,87 +4265,87 @@ exports.debug = debug; // for test
|
|||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const exec = __importStar(__webpack_require__(986));
|
||||
exports.supportedPackageManagers = {
|
||||
npm: {
|
||||
lockFilePatterns: ['package-lock.json', 'yarn.lock'],
|
||||
getCacheFolderCommand: 'npm config get cache'
|
||||
},
|
||||
pnpm: {
|
||||
lockFilePatterns: ['pnpm-lock.yaml'],
|
||||
getCacheFolderCommand: 'pnpm store path'
|
||||
},
|
||||
yarn1: {
|
||||
lockFilePatterns: ['yarn.lock'],
|
||||
getCacheFolderCommand: 'yarn cache dir'
|
||||
},
|
||||
yarn2: {
|
||||
lockFilePatterns: ['yarn.lock'],
|
||||
getCacheFolderCommand: 'yarn config get cacheFolder'
|
||||
}
|
||||
};
|
||||
exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand);
|
||||
if (stderr) {
|
||||
throw new Error(stderr);
|
||||
}
|
||||
return stdout.trim();
|
||||
});
|
||||
const getPackageManagerVersion = (packageManager, command) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const stdOut = yield exports.getCommandOutput(`${packageManager} ${command}`);
|
||||
if (!stdOut) {
|
||||
throw new Error(`Could not retrieve version of ${packageManager}`);
|
||||
}
|
||||
return stdOut;
|
||||
});
|
||||
exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
if (packageManager === 'npm') {
|
||||
return exports.supportedPackageManagers.npm;
|
||||
}
|
||||
else if (packageManager === 'pnpm') {
|
||||
return exports.supportedPackageManagers.pnpm;
|
||||
}
|
||||
else if (packageManager === 'yarn') {
|
||||
const yarnVersion = yield getPackageManagerVersion('yarn', '--version');
|
||||
core.debug(`Consumed yarn version is ${yarnVersion}`);
|
||||
if (yarnVersion.startsWith('1.')) {
|
||||
return exports.supportedPackageManagers.yarn1;
|
||||
}
|
||||
else {
|
||||
return exports.supportedPackageManagers.yarn2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
exports.getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const stdOut = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand);
|
||||
if (!stdOut) {
|
||||
throw new Error(`Could not get cache folder path for ${packageManager}`);
|
||||
}
|
||||
core.debug(`${packageManager} path is ${stdOut}`);
|
||||
return stdOut;
|
||||
});
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const exec = __importStar(__webpack_require__(986));
|
||||
exports.supportedPackageManagers = {
|
||||
npm: {
|
||||
lockFilePatterns: ['package-lock.json', 'yarn.lock'],
|
||||
getCacheFolderCommand: 'npm config get cache'
|
||||
},
|
||||
pnpm: {
|
||||
lockFilePatterns: ['pnpm-lock.yaml'],
|
||||
getCacheFolderCommand: 'pnpm store path'
|
||||
},
|
||||
yarn1: {
|
||||
lockFilePatterns: ['yarn.lock'],
|
||||
getCacheFolderCommand: 'yarn cache dir'
|
||||
},
|
||||
yarn2: {
|
||||
lockFilePatterns: ['yarn.lock'],
|
||||
getCacheFolderCommand: 'yarn config get cacheFolder'
|
||||
}
|
||||
};
|
||||
exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand);
|
||||
if (stderr) {
|
||||
throw new Error(stderr);
|
||||
}
|
||||
return stdout.trim();
|
||||
});
|
||||
const getPackageManagerVersion = (packageManager, command) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const stdOut = yield exports.getCommandOutput(`${packageManager} ${command}`);
|
||||
if (!stdOut) {
|
||||
throw new Error(`Could not retrieve version of ${packageManager}`);
|
||||
}
|
||||
return stdOut;
|
||||
});
|
||||
exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
if (packageManager === 'npm') {
|
||||
return exports.supportedPackageManagers.npm;
|
||||
}
|
||||
else if (packageManager === 'pnpm') {
|
||||
return exports.supportedPackageManagers.pnpm;
|
||||
}
|
||||
else if (packageManager === 'yarn') {
|
||||
const yarnVersion = yield getPackageManagerVersion('yarn', '--version');
|
||||
core.debug(`Consumed yarn version is ${yarnVersion}`);
|
||||
if (yarnVersion.startsWith('1.')) {
|
||||
return exports.supportedPackageManagers.yarn1;
|
||||
}
|
||||
else {
|
||||
return exports.supportedPackageManagers.yarn2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
exports.getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const stdOut = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand);
|
||||
if (!stdOut) {
|
||||
throw new Error(`Could not get cache folder path for ${packageManager}`);
|
||||
}
|
||||
core.debug(`${packageManager} path is ${stdOut}`);
|
||||
return stdOut;
|
||||
});
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
@ -5272,23 +5272,23 @@ module.exports = v1;
|
|||
/***/ (function(__unusedmodule, exports) {
|
||||
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var LockType;
|
||||
(function (LockType) {
|
||||
LockType["Npm"] = "npm";
|
||||
LockType["Pnpm"] = "pnpm";
|
||||
LockType["Yarn"] = "yarn";
|
||||
})(LockType = exports.LockType || (exports.LockType = {}));
|
||||
var State;
|
||||
(function (State) {
|
||||
State["CachePrimaryKey"] = "CACHE_KEY";
|
||||
State["CacheMatchedKey"] = "CACHE_RESULT";
|
||||
})(State = exports.State || (exports.State = {}));
|
||||
var Outputs;
|
||||
(function (Outputs) {
|
||||
Outputs["CacheHit"] = "cache-hit";
|
||||
})(Outputs = exports.Outputs || (exports.Outputs = {}));
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var LockType;
|
||||
(function (LockType) {
|
||||
LockType["Npm"] = "npm";
|
||||
LockType["Pnpm"] = "pnpm";
|
||||
LockType["Yarn"] = "yarn";
|
||||
})(LockType = exports.LockType || (exports.LockType = {}));
|
||||
var State;
|
||||
(function (State) {
|
||||
State["CachePrimaryKey"] = "CACHE_KEY";
|
||||
State["CacheMatchedKey"] = "CACHE_RESULT";
|
||||
})(State = exports.State || (exports.State = {}));
|
||||
var Outputs;
|
||||
(function (Outputs) {
|
||||
Outputs["CacheHit"] = "cache-hit";
|
||||
})(Outputs = exports.Outputs || (exports.Outputs = {}));
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
@ -50588,77 +50588,77 @@ module.exports = require("stream");
|
|||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const cache = __importStar(__webpack_require__(692));
|
||||
const fs_1 = __importDefault(__webpack_require__(747));
|
||||
const constants_1 = __webpack_require__(196);
|
||||
const cache_utils_1 = __webpack_require__(143);
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const cacheLock = core.getInput('cache');
|
||||
yield cachePackages(cacheLock);
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.run = run;
|
||||
const cachePackages = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const state = core.getState(constants_1.State.CacheMatchedKey);
|
||||
const primaryKey = core.getState(constants_1.State.CachePrimaryKey);
|
||||
const packageManagerInfo = yield cache_utils_1.getPackageManagerInfo(packageManager);
|
||||
if (!packageManagerInfo) {
|
||||
core.debug(`Caching for '${packageManager}' is not supported`);
|
||||
return;
|
||||
}
|
||||
const cachePath = yield cache_utils_1.getCacheDirectoryPath(packageManagerInfo, packageManager);
|
||||
if (!fs_1.default.existsSync(cachePath)) {
|
||||
throw new Error(`Cache folder path is retrieved for ${packageManager} but doesn't exist on disk: ${cachePath}`);
|
||||
}
|
||||
if (primaryKey === state) {
|
||||
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
yield cache.saveCache([cachePath], primaryKey);
|
||||
core.info(`Cache saved with the key: ${primaryKey}`);
|
||||
}
|
||||
catch (error) {
|
||||
if (error.name === cache.ValidationError.name) {
|
||||
throw error;
|
||||
}
|
||||
else if (error.name === cache.ReserveCacheError.name) {
|
||||
core.info(error.message);
|
||||
}
|
||||
else {
|
||||
core.warning(`${error.message}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
run();
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const cache = __importStar(__webpack_require__(692));
|
||||
const fs_1 = __importDefault(__webpack_require__(747));
|
||||
const constants_1 = __webpack_require__(196);
|
||||
const cache_utils_1 = __webpack_require__(143);
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const cacheLock = core.getInput('cache');
|
||||
yield cachePackages(cacheLock);
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.run = run;
|
||||
const cachePackages = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const state = core.getState(constants_1.State.CacheMatchedKey);
|
||||
const primaryKey = core.getState(constants_1.State.CachePrimaryKey);
|
||||
const packageManagerInfo = yield cache_utils_1.getPackageManagerInfo(packageManager);
|
||||
if (!packageManagerInfo) {
|
||||
core.debug(`Caching for '${packageManager}' is not supported`);
|
||||
return;
|
||||
}
|
||||
const cachePath = yield cache_utils_1.getCacheDirectoryPath(packageManagerInfo, packageManager);
|
||||
if (!fs_1.default.existsSync(cachePath)) {
|
||||
throw new Error(`Cache folder path is retrieved for ${packageManager} but doesn't exist on disk: ${cachePath}`);
|
||||
}
|
||||
if (primaryKey === state) {
|
||||
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
yield cache.saveCache([cachePath], primaryKey);
|
||||
core.info(`Cache saved with the key: ${primaryKey}`);
|
||||
}
|
||||
catch (error) {
|
||||
if (error.name === cache.ValidationError.name) {
|
||||
throw error;
|
||||
}
|
||||
else if (error.name === cache.ReserveCacheError.name) {
|
||||
core.info(error.message);
|
||||
}
|
||||
else {
|
||||
core.warning(`${error.message}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
run();
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
|
1330
dist/setup/index.js
vendored
1330
dist/setup/index.js
vendored
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
# Advanced usage
|
||||
|
||||
### Check latest version
|
||||
## Check latest version
|
||||
|
||||
The `check-latest` flag defaults to `false`. When set to `false`, 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/). Use the default or set `check-latest` to `false` if you prefer stability and if you want to ensure a specific version of Node.js is always used.
|
||||
|
||||
|
@ -19,7 +19,7 @@ steps:
|
|||
- run: npm test
|
||||
```
|
||||
|
||||
### Architecture
|
||||
## Architecture
|
||||
|
||||
You can use any of the [supported operating systems](https://docs.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners), and the compatible `architecture` can be selected using `architecture`. Values are `x86`, `x64`, `arm64`, `armv6l`, `armv7l`, `ppc64le`, `s390x` (not all of the architectures are available on all platforms).
|
||||
|
||||
|
@ -39,7 +39,43 @@ jobs:
|
|||
- run: npm test
|
||||
```
|
||||
|
||||
### Caching packages dependencies
|
||||
## Caching packages dependencies
|
||||
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:**
|
||||
Yarn caching handles both yarn versions: 1 or 2.
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
cache: 'yarn'
|
||||
- run: yarn install
|
||||
- run: yarn test
|
||||
```
|
||||
|
||||
**Caching pnpm (v6.10+) dependencies:**
|
||||
```yaml
|
||||
# This workflow uses actions that are not certified by GitHub.
|
||||
# They are provided by a third-party and are governed by
|
||||
# separate terms of service, privacy policy, and support
|
||||
# documentation.
|
||||
|
||||
# NOTE: pnpm caching support requires pnpm version >= 6.10.0
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
|
||||
with:
|
||||
version: 6.10.0
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
cache: 'pnpm'
|
||||
- run: pnpm install
|
||||
- run: pnpm test
|
||||
```
|
||||
|
||||
**Using wildcard patterns to cache dependencies**
|
||||
```yaml
|
||||
|
@ -69,7 +105,7 @@ steps:
|
|||
- run: npm test
|
||||
```
|
||||
|
||||
### Multiple Operating Systems and Architectures
|
||||
## Multiple Operating Systems and Architectures
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
|
@ -104,7 +140,7 @@ jobs:
|
|||
- run: npm test
|
||||
```
|
||||
|
||||
### Publish to npmjs and GPR with npm
|
||||
## Publish to npmjs and GPR with npm
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
@ -124,7 +160,7 @@ steps:
|
|||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
```
|
||||
|
||||
### Publish to npmjs and GPR with yarn
|
||||
## Publish to npmjs and GPR with yarn
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
@ -144,7 +180,7 @@ steps:
|
|||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
```
|
||||
|
||||
### Use private packages
|
||||
## Use private packages
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
|
Loading…
Reference in New Issue
Block a user