mirror of
https://github.com/pnpm/action-setup.git
synced 2025-08-29 16:29:05 +08:00
Compare commits
5 Commits
v2.1.0
...
add-to-pat
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0e9c99a89a | ||
![]() |
9087a16275 | ||
![]() |
9c583927b0 | ||
![]() |
43a416008e | ||
![]() |
eb99e9e4c7 |
@@ -54,11 +54,10 @@ on:
|
||||
- pull_request
|
||||
|
||||
jobs:
|
||||
install:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: pnpm/action-setup@v2.1.0
|
||||
- uses: pnpm/action-setup@v2.0.1
|
||||
with:
|
||||
version: 6.0.2
|
||||
```
|
||||
@@ -71,13 +70,12 @@ on:
|
||||
- pull_request
|
||||
|
||||
jobs:
|
||||
install:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: pnpm/action-setup@v2.1.0
|
||||
- uses: pnpm/action-setup@v2.0.1
|
||||
with:
|
||||
version: 6.0.2
|
||||
run_install: |
|
||||
@@ -94,7 +92,6 @@ on:
|
||||
- pull_request
|
||||
|
||||
jobs:
|
||||
cache-and-install:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
@@ -109,7 +106,7 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-
|
||||
|
||||
- uses: pnpm/action-setup@v2.1.0
|
||||
- uses: pnpm/action-setup@v2.0.1
|
||||
with:
|
||||
version: 6.0.2
|
||||
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,7 +1,7 @@
|
||||
import { addPath, exportVariable } from '@actions/core'
|
||||
import * as core from '@actions/core'
|
||||
import { spawn } from 'child_process'
|
||||
import { execPath } from 'process'
|
||||
import path from 'path'
|
||||
import { join } from 'path'
|
||||
import { remove, ensureFile, writeFile } from 'fs-extra'
|
||||
import fetch from 'node-fetch'
|
||||
import { Inputs } from '../inputs'
|
||||
@@ -9,7 +9,7 @@ import { Inputs } from '../inputs'
|
||||
export async function runSelfInstaller(inputs: Inputs): Promise<number> {
|
||||
const { version, dest } = inputs
|
||||
const target = version ? `pnpm@${version}` : 'pnpm'
|
||||
const pkgJson = path.join(dest, 'package.json')
|
||||
const pkgJson = join(dest, 'package.json')
|
||||
|
||||
await remove(dest)
|
||||
await ensureFile(pkgJson)
|
||||
@@ -20,19 +20,19 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
|
||||
stdio: ['pipe', 'inherit', 'inherit'],
|
||||
})
|
||||
|
||||
const response = await fetch('https://pnpm.io/pnpm.js')
|
||||
const response = await fetch('https://pnpm.js.org/pnpm.js')
|
||||
response.body.pipe(cp.stdin)
|
||||
|
||||
const exitCode = await new Promise<number>((resolve, reject) => {
|
||||
const result = 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)
|
||||
if (result === 0) {
|
||||
const pnpmHome = join(dest, 'node_modules/.bin')
|
||||
core.addPath(pnpmHome)
|
||||
core.exportVariable('PNPM_HOME_PATH', pnpmHome)
|
||||
}
|
||||
return exitCode
|
||||
return result
|
||||
}
|
||||
|
||||
export default runSelfInstaller
|
||||
|
Reference in New Issue
Block a user