21 Commits

Author SHA1 Message Date
187ace9a18 test: don't check pnpx 2022-02-10 01:18:35 +02:00
7f8a57faa8 test: update pnpm version 2022-02-10 01:16:10 +02:00
268b4179de Install the self-contained binary version of pnpm
This is a breaking change because the binary version of pnpm
is only available from v6.17.1

close #18
2022-02-10 01:13:09 +02:00
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
7 changed files with 542 additions and 559 deletions

View File

@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
pnpm:
- 4.11.1
- 6.17.1
os:
- ubuntu-latest
- macos-latest
@ -27,10 +27,10 @@ jobs:
- name: Run the action
uses: ./
with:
version: 4.11.1
version: 6.17.1
- name: 'Test: which'
run: which pnpm; which pnpx
run: which pnpm
- name: 'Test: install'
run: pnpm install
@ -44,7 +44,7 @@ jobs:
fail-fast: false
matrix:
pnpm:
- 4.11.1
- 6.17.1
os:
- ubuntu-latest
- macos-latest
@ -56,11 +56,11 @@ jobs:
- name: Run the action
uses: ./
with:
version: 4.11.1
version: 6.17.1
dest: ~/test/pnpm
- name: 'Test: which'
run: which pnpm && which pnpx
run: which pnpm
- name: 'Test: install'
run: pnpm install
@ -74,7 +74,7 @@ jobs:
fail-fast: false
matrix:
pnpm:
- 4.11.1
- 6.17.1
os:
- ubuntu-latest
- macos-latest
@ -112,11 +112,11 @@ jobs:
- name: Run the action
uses: ./
with:
version: 4.11.1
version: 6.17.1
run_install: ${{ matrix.run_install.value }}
- name: 'Test: which'
run: which pnpm; which pnpx
run: which pnpm
- name: 'Test: install'
run: pnpm install

View File

@ -6,7 +6,7 @@ Install pnpm package manager.
### `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`
@ -54,12 +54,13 @@ on:
- pull_request
jobs:
runs-on: ubuntu-latest
install:
runs-on: ubuntu-latest
steps:
- uses: pnpm/action-setup@v2.0.1
with:
version: 6.0.2
steps:
- uses: pnpm/action-setup@v2.1.0
with:
version: 6.0.2
```
### Install pnpm and a few npm packages
@ -70,18 +71,19 @@ on:
- pull_request
jobs:
runs-on: ubuntu-latest
install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2.0.1
with:
version: 6.0.2
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]
- args: [--global, gulp, prettier, typescript]
- uses: pnpm/action-setup@v2.1.0
with:
version: 6.0.2
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]
- args: [--global, gulp, prettier, typescript]
```
### Use cache to reduce installation time
@ -92,26 +94,25 @@ on:
- pull_request
jobs:
runs-on: ubuntu-latest
cache-and-install:
runs-on: ubuntu-latest
steps:
build:
- uses: actions/checkout@v2
steps:
build:
- uses: actions/checkout@v2
- name: Cache pnpm modules
uses: actions/cache@v2
env:
cache-name: cache-pnpm-modules
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-
- name: Cache pnpm modules
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: pnpm/action-setup@v2.0.1
with:
version: 6.0.2
run_install: true
- uses: pnpm/action-setup@v2.1.0
with:
version: 6.0.2
run_install: true
```
**Note:** You don't need to run `pnpm store prune` at the end; post-action has already taken care of that.

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"
},
"dependencies": {
"node-fetch": "^2.6.1",
"expand-tilde": "^2.0.2",
"js-yaml": "^4.0.0",
"ajv": "^6.12.5",
"fs-extra": "^9.1.0",
"@actions/core": "^1.2.6",
"@actions/core": "^1.6.0",
"@types/expand-tilde": "^2.0.0",
"@types/node-fetch": "^2.5.8",
"@types/js-yaml": "^4.0.0",
"@types/fs-extra": "^9.0.8",
"@types/node": "^14.14.35"
"@types/fs-extra": "^9.0.13",
"@types/js-yaml": "^4.0.5",
"@types/node": "^14.18.10",
"@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": {
"typescript": "^4.2.3",
"@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)
endGroup()
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,14 +1,15 @@
import { addPath, exportVariable } from '@actions/core'
import { spawn } from 'child_process'
import { execPath } from 'process'
import { join } from 'path'
import path from 'path'
import { remove, ensureFile, writeFile } from 'fs-extra'
import fetch from 'node-fetch'
import { Inputs } from '../inputs'
export async function runSelfInstaller(inputs: Inputs): Promise<number> {
const { version, dest } = inputs
const target = version ? `pnpm@${version}` : 'pnpm'
const pkgJson = join(dest, 'package.json')
const target = version ? `@pnpm/exe@${version}` : '@pnpm/exe'
const pkgJson = path.join(dest, 'package.json')
await remove(dest)
await ensureFile(pkgJson)
@ -19,13 +20,19 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
stdio: ['pipe', 'inherit', 'inherit'],
})
const response = await fetch('https://pnpm.js.org/pnpm.js')
const response = await fetch('https://get.pnpm.io/v6.16.js')
response.body.pipe(cp.stdin)
return new Promise((resolve, reject) => {
const exitCode = await new Promise<number>((resolve, reject) => {
cp.on('error', reject)
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