Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download releases from github #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 76 additions & 68 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,117 +6,125 @@ Install pnpm package manager.

### `version`

**Required** Version of pnpm to install.
Can either specifiy a specific version of pnpm to install (e.g. "6.14.6") or can
specifiy a version range (in the [semver range
format](https://github.com/npm/node-semver#ranges)). The latest version to
match the range is used and if the input version is not specified, the latest
overall version is used. Version ranges are only supported for versions
starting at 6.13.0 and higher, because that is the first version of pnpm to be
published to github releases.

### `dest`

**Optional** Where to store pnpm files.
This option is obsolete. It is only used when a specific version of pnpm which
is 6.12 or lower is specified. For these old versions of pnpm, the `dest` input
is where to store pnpm files.

### `run_install`

**Optional** (_default:_ `null`) If specified, run `pnpm install`.
If specified, run `pnpm install`.

If `run_install` is either `null` or `false`, pnpm will not install any npm package.
If `run_install` is either `null` (the default) or `false`, pnpm will not install any npm package.

If `run_install` is `true`, pnpm will install dependencies recursively.

If `run_install` is a YAML string representation of either an object or an array, pnpm will execute every install commands.

#### `run_install.recursive`

**Optional** (_type:_ `boolean`, _default:_ `false`) Whether to use `pnpm recursive install`.
(_type:_ `boolean`, _default:_ `false`) Whether to use `pnpm recursive install`.

#### `run_install.cwd`

**Optional** (_type:_ `string`) Working directory when run `pnpm [recursive] install`.
(_type:_ `string`) Working directory when run `pnpm [recursive] install`.

#### `run_install.args`

**Optional** (_type:_ `string[]`) Additional arguments after `pnpm [recursive] install`, e.g. `[--frozen-lockfile, --strict-peer-dependencies]`.
(_type:_ `string[]`) Additional arguments after `pnpm [recursive] install`, e.g. `[--frozen-lockfile, --strict-peer-dependencies]`.

## Outputs

### `dest`
### `bin_dest`

Expanded path of inputs#dest.
Folder containing the `pnpm` executable.

### `bin_dest`
### `dest`

Location of `pnpm` and `pnpx` command.
Expanded path of inputs#dest, only set if a version before "6.14.6" is specified.

## Usage example

### Just install pnpm
### Install latest pnpm and cache store

The following yaml will first install the latest version of pnpm, install node,
and setup caching of the pnpm store.
[actions/setup-node](https://github.com/actions/setup-node) has support for
caching the pnpm store, as long as pnpm is installed first.

```yaml
on:
- push
- pull_request
steps:
- uses: actions/checkout@v2
- uses: pnpm/[email protected]
- uses: actions/setup-node@v2
with:
node-version: "16"
cache: "pnpm"

- run: pnpm install --frozen-lockfile

jobs:
runs-on: ubuntu-latest
# more build/run commands ...

steps:
- uses: pnpm/[email protected]
with:
version: 6.0.2
- run: pnpm store prune
```

### Install pnpm and a few npm packages
### Install specific range of pnpm

```yaml
on:
- push
- pull_request

jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: pnpm/[email protected]
with:
version: 6.0.2
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]
- args: [--global, gulp, prettier, typescript]
```
steps:
- uses: actions/checkout@v2

### Use cache to reduce installation time
- uses: pnpm/[email protected]
with:
version: "^6.14.6"

```yaml
on:
- push
- pull_request

jobs:
runs-on: ubuntu-latest

steps:
build:
- uses: actions/checkout@v2

- 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/[email protected]
with:
version: 6.0.2
run_install: true
- uses: actions/setup-node@v2
with:
node-version: "16"
cache: "pnpm"

- run: pnpm install --frozen-lockfile

# more build/run commands ...

- run: pnpm store prune
```

**Note:** You don't need to run `pnpm store prune` at the end; post-action has already taken care of that.
### Install pnpm and a few npm packages

## Notes
Unfortunately, using `run_install` does not work together with the caching
in `actions/setup-node`. The caching in `actions/setup-node` requires pnpm
to be installed before node, while the `run_install` option
requires node to be installed first. In this situation, you will need to setup
the caching yourself.

This action does not setup Node.js for you, use [actions/setup-node](https://github.com/actions/setup-node) yourself.
```yaml
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: "16"

- uses: pnpm/[email protected]
with:
version: "6.*"
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]
- args: [--global, gulp, prettier, typescript]

# Setup caching here using actions/cache
```

## License

Expand Down
6 changes: 3 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ branding:
inputs:
version:
description: Version of PNPM to install
required: true
required: false
default: ''
dest:
description: Where to store PNPM files
required: false
default: ~/setup-pnpm
run_install:
description: If specified, run `pnpm install`
required: false
default: 'null'
default: ''
runs:
using: node12
main: dist/index.js
post: dist/index.js
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

30 changes: 17 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,29 @@
"scripts": {
"build:schemas": "ts-schema-autogen generate",
"build:ncc": "ncc build --minify --no-source-map-register --no-cache dist/tsc/index.js --out dist/",
"build": "pnpm run build:schemas && tsc && pnpm run build:ncc",
"build": "pnpm run build:schemas && tsc --skipLibCheck && pnpm run build:ncc",
"start": "pnpm run build && sh ./run.sh"
},
"dependencies": {
"node-fetch": "^2.6.1",
"@actions/core": "^1.5.0",
"@actions/tool-cache": "^1.7.1",
"@octokit/rest": "^18.10.0",
"@types/expand-tilde": "^2.0.0",
"@types/fs-extra": "^9.0.12",
"@types/js-yaml": "^4.0.3",
"@types/node": "^14.17.14",
"@types/node-fetch": "^2.5.12",
"ajv": "^6.12.6",
"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/node-fetch": "^2.5.8",
"@types/js-yaml": "^4.0.0",
"@types/fs-extra": "^9.0.8",
"@types/node": "^14.14.35"
"js-yaml": "^4.1.0",
"node-fetch": "^2.6.1",
"semver": "^7.3.5"
},
"devDependencies": {
"typescript": "^4.2.3",
"@ts-schema-autogen/cli": "^0.1.2",
"@vercel/ncc": "^0.27.0"
"@types/semver": "^7.3.8",
"@vercel/ncc": "^0.27.0",
"typescript": "^4.4.2"
}
}
}
Loading