Add support for version ranges (#9)

* Add support for version ranges

* Fix audit

* Update workflow

* Update dist

* Remove unexpected input

* Add  as step
This commit is contained in:
Imran Ismail
2020-09-25 10:47:06 +08:00
committed by GitHub
parent 2a4b82aea8
commit f54a2cb09e
15 changed files with 13232 additions and 3900 deletions

View File

@@ -4,29 +4,32 @@
# Create a JavaScript Action using TypeScript
Use this template to bootstrap the creation of a JavaScript action.:rocket:
Use this template to bootstrap the creation of a TypeScript action.:rocket:
This template includes compilication support, tests, a validation workflow, publishing, and versioning guidance.
This template includes compilation support, tests, a validation workflow, publishing, and versioning guidance.
If you are new, there's also a simpler introduction. See the [Hello World JavaScript Action](https://github.com/actions/hello-world-javascript-action)
If you are new, there's also a simpler introduction. See the [Hello World JavaScript Action](https://github.com/actions/hello-world-javascript-action)
## Create an action from this template
Click the `Use this Template` and provide the new repo details for your action
## Code in Master
## Code in Main
Install the dependencies
Install the dependencies
```bash
$ npm install
```
Build the typescript and package it for distribution
```bash
$ npm run build && npm run pack
$ npm run build && npm run package
```
Run the tests :heavy_check_mark:
Run the tests :heavy_check_mark:
```bash
$ npm test
@@ -55,9 +58,9 @@ import * as core from '@actions/core';
...
async function run() {
try {
try {
...
}
}
catch (error) {
core.setFailed(error.message);
}
@@ -70,23 +73,26 @@ See the [toolkit documentation](https://github.com/actions/toolkit/blob/master/R
## Publish to a distribution branch
Actions are run from GitHub repos so we will checkin the packed dist folder.
Actions are run from GitHub repos so we will checkin the packed dist folder.
Then run [ncc](https://github.com/zeit/ncc) and push the results:
```bash
$ npm run pack
$ npm run package
$ git add dist
$ git commit -a -m "prod dependencies"
$ git push origin releases/v1
```
Your action is now published! :rocket:
Note: We recommend using the `--license` option for ncc, which will create a license file for all of the production node modules used in your project.
Your action is now published! :rocket:
See the [versioning documentation](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)
## Validate
You can now validate the action by referencing `./` in a workflow in your repo (see [test.yml](.github/workflows/test.yml)])
You can now validate the action by referencing `./` in a workflow in your repo (see [test.yml](.github/workflows/test.yml))
```yaml
uses: ./
@@ -94,8 +100,8 @@ with:
milliseconds: 1000
```
See the [actions tab](https://github.com/actions/javascript-action/actions) for runs of this action! :rocket:
See the [actions tab](https://github.com/actions/typescript-action/actions) for runs of this action! :rocket:
## Usage:
After testing you can [create a v1 tag](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md) to reference the stable and latest V1 action
After testing you can [create a v1 tag](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md) to reference the stable and latest V1 action