From 0f813f3bf051034b66e2792bd8c8d88777bf2981 Mon Sep 17 00:00:00 2001 From: hustcer Date: Fri, 29 Apr 2022 11:09:56 +0800 Subject: [PATCH] Bump version v1-beta1 --- .gitignore | 2 ++ README.md | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++- package.json | 2 +- 3 files changed, 85 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 0256f92..6440fda 100644 --- a/.gitignore +++ b/.gitignore @@ -119,3 +119,5 @@ typings/ .vscode-test # End of https://www.toptal.com/developers/gitignore/api/node + +TODO.md diff --git a/README.md b/README.md index 57ce11d..4f56e86 100644 --- a/README.md +++ b/README.md @@ -1 +1,82 @@ -# Setup-nu +# setup-nu + +![build](https://img.shields.io/github/workflow/status/hustcer/setup-nu/build) + +This GitHub Action will setup a [Nushell](https://github.com/nushell/nushell) environment for you. + +## Usage + +### Examples + +In most cases you need to specify the `version` of Nushell to be used in your workflow. +For example the following installs the `v0.61.0` version of [Nushell](https://github.com/nushell/nushell). +Then you can set the command you want to run in the following steps, and don't forget to set `shell: nu {0}` +to make the commands be execute by `nu` + +```yaml +- uses: hustcer/setup-nu@v1-beta1 + with: + version: 0.61.0 +- run: $'Nu version info:(char nl)'; version + shell: nu {0} +- name: Default shell will be `nu` + shell: nu {0} + run: | + $'Nu path:(which nu)(char nl)' + def greeting [name: string] { + print $'Hello ($name)' + } + greeting hustcer +``` + +Of cause, You can also set the default shell to `nu` check the following examples: + +1. https://github.com/hustcer/setup-nu/blob/main/.github/workflows/run-test.yaml +2. https://github.com/hustcer/setup-nu/blob/main/.github/workflows/run-matrix.yaml + +If you want to use the latest version of nushell you can specify this by set +`check-latest` to `true`. For example the following installs the latest version: + +```yaml +- uses: hustcer/setup-nu@v1-beta1 + with: + check-latest: true +- run: $'Nu version info:(char nl)'; version +``` + +**Note**: Before nushell reaches 1.0, each version may change a lot, it is recommend +that you use a specified version instead. + +In rare circumstances you might get rate limiting errors, this is because this +workflow has to make requests to GitHub API in order to list available releases. +If this happens you can set the `GITHUB_TOKEN` environment variable. + +```yaml +- uses: hustcer/setup-nu@v1-beta1 + with: + version: 0.61.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +``` + +### Inputs + +| Name | Required | Description | Type | Default | +| -------------- | -------- | ---------------------------------------------------- | ------ | ------- | +| `version` | no | A valid NPM-style semver specification. | string | * | +| `check-latest` | no | Set to `true` if you want to use the latest version | bool | | + +The semver specification is passed directly to NPM's [semver package](https://www.npmjs.com/package/semver). +This GitHub Action will install the latest matching release. Examples include: + +- `version: '*'` latest version (default). +- `version: '0.1'` equivalent to `>=0.1.0 <0.2.0`. +- `version: '0.1.x'` equivalent to `>=0.1.0 <0.2.0`. +- `version: '0.1.0'` equivalent to `=0.1.0`. +- `version: '^0.1.0'` equivalent to `>=0.1.0 <0.2.0`. + +## License + +Licensed under: + +- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) diff --git a/package.json b/package.json index dfdc3db..ba39aba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "setup-nu", - "version": "0.1.0", + "version": "1.0.0", "description": "Install nushell", "main": "dist/index.js", "private": true,