22 Commits

Author SHA1 Message Date
2270f39ef6 v2.1.0 2022-02-08 19:53:18 +07:00
394c848db6 Update the bundle 2022-02-08 19:50:57 +07:00
e13928ccc5 Merge pull request #27 from metonym/fix-jobs-syntax
Specify job name to fix syntax error
2022-02-08 19:48:36 +07:00
93bd5a123d Merge pull request #29 from pnpm/pnpm-v7
The pnpm home directory should be added to PATH and PNPM_HOME
2022-02-08 19:47:28 +07:00
9eb14dd77c decrease bundle size 2022-02-08 14:44:50 +02:00
eafb777c56 download script from pnpm.io 2022-02-08 00:39:20 +02:00
e6378df420 PNPM_HOME_PATH=>PNPM_HOME 2022-02-08 00:21:53 +02:00
6ff6e97bc6 The pnpm home directory should be added to PATH and PNPM_HOME
This change is needed to make the action compatible with pnpm v7.

Related breaking change in pnpm: pnpm/pnpm#4280
2022-02-07 23:15:44 +02:00
45d9c91ff6 Specify job name to fix syntax error 2022-01-29 08:17:29 -08:00
15569a497d Merge pull request #26 from ai/patch-1
Improve `version` docs
2021-12-16 21:20:06 +07:00
d70eebd14a Update README.md
Co-authored-by: Khải <hvksmr1996@gmail.com>
2021-12-16 17:18:46 +03:00
3bf8acf16f Improve version docs 2021-12-16 17:12:07 +03:00
3c2fe8c592 Merge pull request #21 from gaggle/patch-1
Spelling
2021-10-12 19:45:45 +07:00
76cc04cd5e Spelling 2021-10-12 13:34:10 +02:00
bcad811784 Remove unused env from examples 2021-07-24 08:25:23 +07:00
602b36f177 Remove uses of undefined variables from examples 2021-07-24 08:22:22 +07:00
74a0fdc1a4 Merge pull request #14 from Jack-Works-forks/master
Update README: use lockfile hash instead of package.json hash
2021-06-01 09:44:13 +07:00
493e98ec5e Update README.md 2021-06-01 10:42:26 +08:00
646cdf4821 Update versions in README examples to the latest 2021-04-24 21:13:36 +07:00
a1ba6cf5ae Merge pull request #11 from pnpm/zkochan-patch-1
docs(readme): PNPM=>pnpm
2021-03-27 18:50:58 +07:00
41b381a08b docs(readme): PNPM=>pnpm 2021-03-27 13:45:01 +02:00
3236b209b5 Merge branch 'v2' 2021-03-27 16:56:27 +07:00
6 changed files with 537 additions and 554 deletions

View File

@ -1,16 +1,16 @@
# Setup PNPM # Setup pnpm
Install PNPM package manager. Install pnpm package manager.
## Inputs ## Inputs
### `version` ### `version`
**Required** Version of PNPM to install. **Required** Version of pnpm to install. It supports npm versioning scheme, it could be an exact version (such as `6.24.1`), or a version range (such as `6`, `6.x.x`, `6.24.x`, `^6.24.1`, `*`, etc.), or `latest`.
### `dest` ### `dest`
**Optional** Where to store PNPM files. **Optional** Where to store pnpm files.
### `run_install` ### `run_install`
@ -46,7 +46,7 @@ Location of `pnpm` and `pnpx` command.
## Usage example ## Usage example
### Just install PNPM ### Just install pnpm
```yaml ```yaml
on: on:
@ -54,15 +54,16 @@ on:
- pull_request - pull_request
jobs: jobs:
install:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: pnpm/action-setup@v1.2.1 - uses: pnpm/action-setup@v2.1.0
with: with:
version: 5.17.2 version: 6.0.2
``` ```
### Install PNPM and a few NPM packages ### Install pnpm and a few npm packages
```yaml ```yaml
on: on:
@ -70,14 +71,15 @@ on:
- pull_request - pull_request
jobs: jobs:
install:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: pnpm/action-setup@v1.2.1 - uses: pnpm/action-setup@v2.1.0
with: with:
version: 5.17.2 version: 6.0.2
run_install: | run_install: |
- recursive: true - recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies] args: [--frozen-lockfile, --strict-peer-dependencies]
@ -92,6 +94,7 @@ on:
- pull_request - pull_request
jobs: jobs:
cache-and-install:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -100,17 +103,15 @@ jobs:
- name: Cache pnpm modules - name: Cache pnpm modules
uses: actions/cache@v2 uses: actions/cache@v2
env:
cache-name: cache-pnpm-modules
with: with:
path: ~/.pnpm-store path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/package.json') }} key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: | restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}- ${{ runner.os }}-
- uses: pnpm/action-setup@v1.2.1 - uses: pnpm/action-setup@v2.1.0
with: with:
version: 5.17.2 version: 6.0.2
run_install: true run_install: true
``` ```

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@ -7,21 +7,21 @@
"start": "pnpm run build && sh ./run.sh" "start": "pnpm run build && sh ./run.sh"
}, },
"dependencies": { "dependencies": {
"node-fetch": "^2.6.1", "@actions/core": "^1.6.0",
"expand-tilde": "^2.0.2",
"js-yaml": "^4.0.0",
"ajv": "^6.12.5",
"fs-extra": "^9.1.0",
"@actions/core": "^1.2.6",
"@types/expand-tilde": "^2.0.0", "@types/expand-tilde": "^2.0.0",
"@types/node-fetch": "^2.5.8", "@types/fs-extra": "^9.0.13",
"@types/js-yaml": "^4.0.0", "@types/js-yaml": "^4.0.5",
"@types/fs-extra": "^9.0.8", "@types/node": "^14.18.10",
"@types/node": "^14.14.35" "@types/node-fetch": "^2.5.12",
"ajv": "^6.12.6",
"expand-tilde": "^2.0.2",
"fs-extra": "^9.1.0",
"js-yaml": "^4.1.0",
"node-fetch": "^2.6.7"
}, },
"devDependencies": { "devDependencies": {
"typescript": "^4.2.3",
"@ts-schema-autogen/cli": "^0.1.2", "@ts-schema-autogen/cli": "^0.1.2",
"@vercel/ncc": "^0.27.0" "@vercel/ncc": "^0.27.0",
"typescript": "^4.5.5"
} }
} }

971
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@ export async function install(inputs: Inputs) {
const status = await runSelfInstaller(inputs) const status = await runSelfInstaller(inputs)
endGroup() endGroup()
if (status) { if (status) {
return setFailed(`Something does wrong, self-installer exits with code ${status}`) return setFailed(`Something went wrong, self-installer exits with code ${status}`)
} }
} }

View File

@ -1,6 +1,7 @@
import { addPath, exportVariable } from '@actions/core'
import { spawn } from 'child_process' import { spawn } from 'child_process'
import { execPath } from 'process' import { execPath } from 'process'
import { join } from 'path' import path from 'path'
import { remove, ensureFile, writeFile } from 'fs-extra' import { remove, ensureFile, writeFile } from 'fs-extra'
import fetch from 'node-fetch' import fetch from 'node-fetch'
import { Inputs } from '../inputs' import { Inputs } from '../inputs'
@ -8,7 +9,7 @@ import { Inputs } from '../inputs'
export async function runSelfInstaller(inputs: Inputs): Promise<number> { export async function runSelfInstaller(inputs: Inputs): Promise<number> {
const { version, dest } = inputs const { version, dest } = inputs
const target = version ? `pnpm@${version}` : 'pnpm' const target = version ? `pnpm@${version}` : 'pnpm'
const pkgJson = join(dest, 'package.json') const pkgJson = path.join(dest, 'package.json')
await remove(dest) await remove(dest)
await ensureFile(pkgJson) await ensureFile(pkgJson)
@ -19,13 +20,19 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
stdio: ['pipe', 'inherit', 'inherit'], stdio: ['pipe', 'inherit', 'inherit'],
}) })
const response = await fetch('https://pnpm.js.org/pnpm.js') const response = await fetch('https://pnpm.io/pnpm.js')
response.body.pipe(cp.stdin) response.body.pipe(cp.stdin)
return new Promise((resolve, reject) => { const exitCode = await new Promise<number>((resolve, reject) => {
cp.on('error', reject) cp.on('error', reject)
cp.on('close', resolve) cp.on('close', resolve)
}) })
if (exitCode === 0) {
const pnpmHome = path.join(dest, 'node_modules/.bin')
addPath(pnpmHome)
exportVariable('PNPM_HOME', pnpmHome)
}
return exitCode
} }
export default runSelfInstaller export default runSelfInstaller