Skip to content

Commit

Permalink
docs: add example
Browse files Browse the repository at this point in the history
  • Loading branch information
EndBug committed Jul 2, 2020
1 parent 8220b02 commit a6fc5f8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,29 @@ Here's an example:

Please keep in mind that when the `static-checking` option is used the `commit` output is not given.

## Examples

### Publishing automatically to both NPM & GitHub Package Registry

If you want to see how to publish automatically your package to both NPM & GPR, please see [this](doc/auto-publish-example.yml) example workflow ;)
If you want to see how to publish automatically your package to both NPM & GPR, please see [this](doc/auto-publish-example.yml) example workflow ;)
You can also find a more in-depth guide in this [here](doc/auto-publish-walkthrough.md).

### Static-checking with your latest version on NPM

If you want to cehck whether the version has changed since your last published version on NPM, you can do it using `file-url` and `static-checking`:
- `file-url`: you need to use something like a raw.githubusercontent.com or unpkg.com URL, an API that will give you a JSON response with your package file.
- `static-checking`: you're expecting your last published version to be older than the one in your repo, so we'll use `localIsNew`

```yaml
- id: check
uses: EndBug/version-check@v1
with:
file-url: https://unpkg.com/your-package@latest/package.json
static-checking: localIsNew
```

This step will have a `true` `changed` output every time our version is newer (there won't be any `commit` output)

## Contributing

If you want to contribute to the action, even by just raising a problem or proposing an idea, you can click [here](CONTRIBUTING.md) to find out how to do it ;)
Expand Down
2 changes: 2 additions & 0 deletions doc/auto-publish-walkthrough.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ steps:
id: check # This will be the reference for later
```

You could also use the `static-check` and `file-url` option to detect teh version change, but if more checks run at the same time this can make it try to publish it multiple times.

## 3. Using the results of the check to edit the behavior of the workflow

[`version-check`][3] provides three outputs: `changed` (whether there has been an update), `type` (the type of update, like "patch", "minor", ...) and `version` (the new version).
Expand Down

0 comments on commit a6fc5f8

Please sign in to comment.