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

feat: add docker support to action directly #375

Merged
merged 15 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
8 changes: 7 additions & 1 deletion .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,10 @@ plugins:
- preset: conventionalcommits
- - "@semantic-release/release-notes-generator"
- preset: conventionalcommits
- "@semantic-release/github"
- - "@semantic-release/exec"
- prepareCmd: "VERSION=${nextRelease.version} npm run bump:version"
- - "@semantic-release/git"
- assets:
- "action.yml"
message: "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
Shurtu-gal marked this conversation as resolved.
Show resolved Hide resolved
- "@semantic-release/github"
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ export GITHUB_WORKSPACE = $(shell pwd)
run:
@bash ./entrypoint.sh $(DEFAULT_VERSION) $(DEFAULT_COMMAND) $(TEST_FILEPATH) $(DEFAULT_TEMPLATE) $(DEFAULT_LANGUAGE) $(DEFAULT_OUTPUT) $(DEFAULT_PARAMETERS) $(DEFAULT_CUSTOM_COMMANDS)

# Updates the action.yml file with the latest version of the action got from $VERSION env variable
generate-assets:
version=$$(echo ${VERSION} | sed 's/v//g'); \
sed "s/docker:\/\/asyncapi\/github-action-for-cli:.*/docker:\/\/asyncapi\/github-action-for-cli:$$version'/g" action.yml > action.yml.tmp
@mv action.yml.tmp action.yml
derberg marked this conversation as resolved.
Show resolved Hide resolved

test: test-default test-validate-success test-validate-fail test-custom-output test-custom-commands test-optimize test-bundle test-convert

# Test cases
Expand Down
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Sample usage:

```yaml
- name: Generating HTML from my AsyncAPI document
uses: docker://asyncapi/github-action-for-cli:2.0.0
uses: asyncapi/github-action-for-cli@v3.0.2 # You can use any version you want
with:
custom_command: bundle ./asyncapi.yaml --output final-asyncapi.yaml
```
Expand Down Expand Up @@ -91,15 +91,20 @@ The command that you use might support and even require specific parameters to b
> [!NOTE]
> For template parameters, you need to pass them as `-p <template_parameters>` as can be seen in CLI documentation.


## Example usage

> [!WARNING]
> Using `docker://asyncapi/github-action-for-cli` will not work as expected. This is because the GitHub Actions runner does not pass params to the docker image correctly. This is why we recommend to use `asyncapi/github-action-for-cli` instead.
> However, you don't need to worry as it won't build the image every time. It will pull it from Docker Hub as it is already built there.

### Basic

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

```yaml
- name: Generating Markdown from my AsyncAPI document
uses: docker://asyncapi/github-action-for-cli:3.0.0
uses:
Shurtu-gal marked this conversation as resolved.
Show resolved Hide resolved
```

### Using all possible inputs
Expand All @@ -108,7 +113,7 @@ In case you do not want to use defaults, you for example want to use different t

```yaml
- name: Generating HTML from my AsyncAPI document
uses: docker://asyncapi/github-action-for-cli:3.0.0
uses: asyncapi/github-action-for-cli@v3.0.2 # You can use any version you want
with:
command: generate
filepath: ./docs/api/asyncapi.yaml
Expand Down Expand Up @@ -140,7 +145,7 @@ jobs:

#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: docker://asyncapi/github-action-for-cli:3.0.0
uses: asyncapi/github-action-for-cli@v3.0.2 # You can use any version you want
with:
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
Expand Down Expand Up @@ -177,7 +182,7 @@ jobs:
uses: actions/checkout@v2

- name: Generating models from my AsyncAPI document
uses: docker://asyncapi/github-action-for-cli:3.0.0
uses: asyncapi/github-action-for-cli@v3.0.2 # You can use any version you want
with:
command: generate
filepath: docs/api/my-asyncapi.yml
Expand Down Expand Up @@ -205,7 +210,7 @@ jobs:
uses: actions/checkout@v2

- name: Validating AsyncAPI document
uses: docker://asyncapi/github-action-for-cli:3.0.0
uses: asyncapi/github-action-for-cli@v3.0.2 # You can use any version you want
with:
command: validate
filepath: docs/api/my-asyncapi.yml
Expand Down
3 changes: 2 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ inputs:

runs:
using: 'docker'
image: 'Dockerfile'
# This is the image that will be used to run the action. The version of the image is changed automatically by releasing a new version of the action.
image: 'docker://asyncapi/github-action-for-cli:3.0.1'
args:
- ${{ inputs.cli_version }}
- ${{ inputs.command }}
Expand Down
Loading
Loading