mirror of
https://github.com/pnpm/action-setup.git
synced 2025-07-08 22:59:22 +08:00
Compare commits
10 Commits
pnpm-v7-te
...
feat/18
Author | SHA1 | Date | |
---|---|---|---|
187ace9a18 | |||
7f8a57faa8 | |||
268b4179de | |||
2270f39ef6 | |||
394c848db6 | |||
e13928ccc5 | |||
93bd5a123d | |||
9eb14dd77c | |||
eafb777c56 | |||
45d9c91ff6 |
18
.github/workflows/test.yaml
vendored
18
.github/workflows/test.yaml
vendored
@ -15,7 +15,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
pnpm:
|
pnpm:
|
||||||
- 4.11.1
|
- 6.17.1
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- macos-latest
|
- macos-latest
|
||||||
@ -27,10 +27,10 @@ jobs:
|
|||||||
- name: Run the action
|
- name: Run the action
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
version: 4.11.1
|
version: 6.17.1
|
||||||
|
|
||||||
- name: 'Test: which'
|
- name: 'Test: which'
|
||||||
run: which pnpm; which pnpx
|
run: which pnpm
|
||||||
|
|
||||||
- name: 'Test: install'
|
- name: 'Test: install'
|
||||||
run: pnpm install
|
run: pnpm install
|
||||||
@ -44,7 +44,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
pnpm:
|
pnpm:
|
||||||
- 4.11.1
|
- 6.17.1
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- macos-latest
|
- macos-latest
|
||||||
@ -56,11 +56,11 @@ jobs:
|
|||||||
- name: Run the action
|
- name: Run the action
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
version: 4.11.1
|
version: 6.17.1
|
||||||
dest: ~/test/pnpm
|
dest: ~/test/pnpm
|
||||||
|
|
||||||
- name: 'Test: which'
|
- name: 'Test: which'
|
||||||
run: which pnpm && which pnpx
|
run: which pnpm
|
||||||
|
|
||||||
- name: 'Test: install'
|
- name: 'Test: install'
|
||||||
run: pnpm install
|
run: pnpm install
|
||||||
@ -74,7 +74,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
pnpm:
|
pnpm:
|
||||||
- 4.11.1
|
- 6.17.1
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- macos-latest
|
- macos-latest
|
||||||
@ -112,11 +112,11 @@ jobs:
|
|||||||
- name: Run the action
|
- name: Run the action
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
version: 4.11.1
|
version: 6.17.1
|
||||||
run_install: ${{ matrix.run_install.value }}
|
run_install: ${{ matrix.run_install.value }}
|
||||||
|
|
||||||
- name: 'Test: which'
|
- name: 'Test: which'
|
||||||
run: which pnpm; which pnpx
|
run: which pnpm
|
||||||
|
|
||||||
- name: 'Test: install'
|
- name: 'Test: install'
|
||||||
run: pnpm install
|
run: pnpm install
|
||||||
|
@ -54,10 +54,11 @@ on:
|
|||||||
- pull_request
|
- pull_request
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
install:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: pnpm/action-setup@v2.0.1
|
- uses: pnpm/action-setup@v2.1.0
|
||||||
with:
|
with:
|
||||||
version: 6.0.2
|
version: 6.0.2
|
||||||
```
|
```
|
||||||
@ -70,12 +71,13 @@ 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@v2.0.1
|
- uses: pnpm/action-setup@v2.1.0
|
||||||
with:
|
with:
|
||||||
version: 6.0.2
|
version: 6.0.2
|
||||||
run_install: |
|
run_install: |
|
||||||
@ -92,6 +94,7 @@ on:
|
|||||||
- pull_request
|
- pull_request
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
cache-and-install:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@ -106,7 +109,7 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-
|
${{ runner.os }}-
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v2.0.1
|
- uses: pnpm/action-setup@v2.1.0
|
||||||
with:
|
with:
|
||||||
version: 6.0.2
|
version: 6.0.2
|
||||||
run_install: true
|
run_install: true
|
||||||
|
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -1,15 +1,15 @@
|
|||||||
import * as core from '@actions/core'
|
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'
|
||||||
|
|
||||||
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/exe@${version}` : '@pnpm/exe'
|
||||||
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)
|
||||||
@ -20,7 +20,7 @@ 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://get.pnpm.io/v6.16.js')
|
||||||
response.body.pipe(cp.stdin)
|
response.body.pipe(cp.stdin)
|
||||||
|
|
||||||
const exitCode = await new Promise<number>((resolve, reject) => {
|
const exitCode = await new Promise<number>((resolve, reject) => {
|
||||||
@ -28,9 +28,9 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
|
|||||||
cp.on('close', resolve)
|
cp.on('close', resolve)
|
||||||
})
|
})
|
||||||
if (exitCode === 0) {
|
if (exitCode === 0) {
|
||||||
const pnpmHome = join(dest, 'node_modules/.bin')
|
const pnpmHome = path.join(dest, 'node_modules/.bin')
|
||||||
core.addPath(pnpmHome)
|
addPath(pnpmHome)
|
||||||
core.exportVariable('PNPM_HOME', pnpmHome)
|
exportVariable('PNPM_HOME', pnpmHome)
|
||||||
}
|
}
|
||||||
return exitCode
|
return exitCode
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user