Skip to content

Commit

Permalink
feat!: use latest generator rc release in the action (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
derberg authored Nov 13, 2020
1 parent 199fbf9 commit c648dd3
Show file tree
Hide file tree
Showing 8 changed files with 74,015 additions and 59,026 deletions.
45 changes: 15 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ This action generates whatever you want using your AsyncAPI document. It uses [A

### `template`

Template for the generator. Official templates are listed here https://github.com/search?q=topic%3Aasyncapi+topic%3Agenerator+topic%3Atemplate. You can pass template as npm package, url to git repository, link to tar file or local template.
Template for the generator. Official templates are listed here https://github.com/asyncapi/generator#list-of-official-generator-templates. You can pass template as npm package, url to git repository, link to tar file or local template.

**Default** points to `@asyncapi/markdown-template@0.3.0` template.
**Default** points to `@asyncapi/markdown-template@0.10.0` template.

> We recommend to always specify the version of the template to not encounter any issues with the action in case of release of the template that is not compatible with given version of the generator.
Expand All @@ -28,55 +28,36 @@ Directory where to put the generated files.

**Default** points to `output` directory in the working directory.

## Outputs

### `files`

List of generated files.

## Example usage

### Basic

In case all defaults are fine for you, just add such step:

```
```yaml
- name: Generating Markdown from my AsyncAPI document
uses: asyncapi/github-action-for-generator@v0.2.0
uses: asyncapi/github-action-for-generator@v1
```
### Using all possible inputs
In case you do not want to use defaults, you for example want to use different template:
```
```yaml
- name: Generating HTML from my AsyncAPI document
uses: asyncapi/github-action-for-generator@v0.2.0
uses: asyncapi/github-action-for-generator@v1
with:
template: '@asyncapi/html-template@0.3.0' #In case of template from npm, because of @ it must be in quotes
template: '@asyncapi/html-template@0.15.4' #In case of template from npm, because of @ it must be in quotes
filepath: docs/api/my-asyncapi.yml
parameters: baseHref=/test-experiment/ sidebarOrganization=byTags #space separated list of key/values
output: generated-html
```
### Accessing output of generation step

In case you want to have more steps in your workflow after generation and you need to know what files were exactly generated, you can access this information as shown below:

```
- name: Generating Markdown from my AsyncAPI document
id: generation
uses: asyncapi/[email protected]
- name: Another step where I want to know what files were generated so I can pass it to another step and process them forward if needed
run: echo '${{steps.generation.outputs.files}}'
```

### Example workflow with publishing generated HTML to GitHub Pages
In case you want to validate your asyncapi file first, and also send generated HTML to GitHub Pages this is how full workflow could look like:
```
```yaml
name: AsyncAPI documents processing

on:
Expand All @@ -93,15 +74,15 @@ jobs:

#Using another action for AsyncAPI for validation
- name: Validating AsyncAPI document
uses: WaleedAshraf/asyncapi-github-action@v0.0.3
uses: WaleedAshraf/asyncapi-github-action@v1
with:
filepath: docs/api/my-asyncapi.yml

#In case you do not want to use defaults, you for example want to use different template
- name: Generating HTML from my AsyncAPI document
uses: asyncapi/github-action-for-generator@v0.2.0
uses: asyncapi/github-action-for-generator@v1
with:
template: '@asyncapi/html-template@0.3.0' #In case of template from npm, because of @ it must be in quotes
template: '@asyncapi/html-template@0.9.0' #In case of template from npm, because of @ it must be in quotes
filepath: docs/api/my-asyncapi.yml
parameters: baseHref=/test-experiment/ sidebarOrganization=byTags #space separated list of key/values
output: generated-html
Expand All @@ -114,3 +95,7 @@ jobs:
BRANCH: gh-pages
FOLDER: generated-html
```
## Troubleshooting
You can enable more log information in GitHub Action by adding `ACTIONS_STEP_DEBUG` secret to repository where you want to use this action. Set the value of this secret to `true` and you''ll notice more debug logs from this action.
5 changes: 1 addition & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: 'Use this action to generate docs or code from your AsyncAPI docume
inputs:
template:
description: 'Template for the generator. Official templates are listed here https://github.com/search?q=topic%3Aasyncapi+topic%3Agenerator+topic%3Atemplate. You can pass template as npm package, url to git repository, link to tar file or local template.'
default: '@asyncapi/markdown-template'
default: '@asyncapi/markdown-template@0.10.0'
required: false
filepath:
description: 'Location of the AsyncAPI document.'
Expand All @@ -16,9 +16,6 @@ inputs:
description: 'Directory where to put the generated files.'
required: false
default: 'output'
outputs:
files:
description: 'List of generated files.'
runs:
using: 'node12'
main: 'dist/index.js'
Expand Down
Binary file modified dist/fsevents.node
Binary file not shown.
Loading

0 comments on commit c648dd3

Please sign in to comment.