diff --git a/.github/workflows/bounty-program-commands.yml b/.github/workflows/bounty-program-commands.yml new file mode 100644 index 00000000000..433f7d953d3 --- /dev/null +++ b/.github/workflows/bounty-program-commands.yml @@ -0,0 +1,90 @@ +# This workflow is centrally managed at https://github.com/asyncapi/.github/ +# Don't make changes to this file in this repository, as they will be overwritten with +# changes made to the same file in the abovementioned repository. + +# The purpose of this workflow is to allow Bounty Team members +# (https://github.com/orgs/asyncapi/teams/bounty_team) to issue commands to the +# organization's global AsyncAPI bot related to the Bounty Program, while at the +# same time preventing unauthorized users from misusing them. + +name: Bounty Program commands + +on: + issue_comment: + types: + - created + +jobs: + guard-against-unauthorized-use: + if: > + github.actor != ('aeworxet' || 'thulieblack') && + ( + contains(github.event.comment.body, '/bounty' ) + ) + + runs-on: ubuntu-latest + + steps: + - name: ❌ @${{github.actor}} made an unauthorized attempt to use a Bounty Program's command + uses: actions/github-script@v6 + + with: + github-token: ${{ secrets.GH_TOKEN }} + script: | + const commentText = `❌ @${{github.actor}} is not authorized to use the Bounty Program's commands. + These commands can only be used by members of the [Bounty Team](https://github.com/orgs/asyncapi/teams/bounty_team).`; + + console.log(`❌ @${{github.actor}} made an unauthorized attempt to use a Bounty Program's command.`); + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: commentText + }) + + add-label-bounty: + if: > + github.actor == ('aeworxet' || 'thulieblack') && + ( + contains(github.event.comment.body, '/bounty' ) + ) + + runs-on: ubuntu-latest + env: + BOUNTY_PROGRAM_LABELS_JSON: | + [ + {"name": "bounty", "color": "0e8a16", "description": "Participation in the Bounty Program"} + ] + + steps: + - name: Add label `bounty` + uses: actions/github-script@v6 + + with: + github-token: ${{ secrets.GH_TOKEN }} + script: | + const BOUNTY_PROGRAM_LABELS = JSON.parse(process.env.BOUNTY_PROGRAM_LABELS_JSON); + let LIST_OF_LABELS_FOR_REPO = await github.rest.issues.listLabelsForRepo({ + owner: context.repo.owner, + repo: context.repo.repo, + }); + + LIST_OF_LABELS_FOR_REPO = LIST_OF_LABELS_FOR_REPO.data.map(key => key.name); + + if (!LIST_OF_LABELS_FOR_REPO.includes(BOUNTY_PROGRAM_LABELS[0].name)) { + await github.rest.issues.createLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + name: BOUNTY_PROGRAM_LABELS[0].name, + color: BOUNTY_PROGRAM_LABELS[0].color, + description: BOUNTY_PROGRAM_LABELS[0].description + }); + } + + console.log('Adding label `bounty`...'); + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: [BOUNTY_PROGRAM_LABELS[0].name] + }) diff --git a/.github/workflows/if-docker-pr-testing.yml b/.github/workflows/if-docker-pr-testing.yml new file mode 100644 index 00000000000..1b9ed314b13 --- /dev/null +++ b/.github/workflows/if-docker-pr-testing.yml @@ -0,0 +1,67 @@ +#This action is centrally managed in https://github.com/asyncapi/.github/ +#Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo +#It does magic only if there is a Dockerfile in the root of the project +name: PR testing - if Docker + +on: + pull_request: + types: [opened, reopened, synchronize, ready_for_review] + +env: + IMAGE_NAME: ${{ github.repository }} + +jobs: + test-docker-pr: + name: Test Docker build + runs-on: ubuntu-latest + + steps: + - if: > + !github.event.pull_request.draft && !( + (github.actor == 'asyncapi-bot' && ( + startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') || + startsWith(github.event.pull_request.title, 'chore(release):') + )) || + (github.actor == 'asyncapi-bot-eve' && ( + startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') || + startsWith(github.event.pull_request.title, 'chore(release):') + )) || + (github.actor == 'allcontributors[bot]' && + startsWith(github.event.pull_request.title, 'docs: add') + ) + ) + id: should_run + name: Should Run + run: echo "shouldrun=true" >> $GITHUB_OUTPUT + + - if: steps.should_run.outputs.shouldrun == 'true' + name: Checkout repository + uses: actions/checkout@v3 + + - if: steps.should_run.outputs.shouldrun == 'true' + name: Check if project has a Dockerfile + id: docker + run: test -e ./Dockerfile && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT + shell: bash + + - if: steps.docker.outputs.exists == 'true' + name: Set up Docker Buildx + uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # use 2.5.0 https://github.com/docker/setup-buildx-action/releases/tag/v2.5.0 + + - if: steps.docker.outputs.exists == 'true' + name: Extract metadata for Docker + id: meta + uses: docker/metadata-action@507c2f2dc502c992ad446e3d7a5dfbe311567a96 # use 4.3.0 https://github.com/docker/metadata-action/releases/tag/v4.3.0 + with: + images: ${{ env.IMAGE_NAME }} + + - if: steps.docker.outputs.exists == 'true' + name: Build Docker image + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # use 4.0.0 https://github.com/docker/build-push-action/releases/tag/v4.0.0 + with: + context: . + push: false + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/assets/create-glee-app/templates/default/package-lock.json b/assets/create-glee-app/templates/default/package-lock.json index 796d9c1b3dc..403a445fc70 100644 --- a/assets/create-glee-app/templates/default/package-lock.json +++ b/assets/create-glee-app/templates/default/package-lock.json @@ -9,7 +9,7 @@ "version": "0.1.0", "license": "Apache-2.0", "dependencies": { - "@asyncapi/glee": "^0.35.21" + "@asyncapi/glee": "^0.36.0" }, "devDependencies": { "@types/node": "^20.5.9" @@ -169,9 +169,9 @@ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, "node_modules/@asyncapi/glee": { - "version": "0.35.21", - "resolved": "https://registry.npmjs.org/@asyncapi/glee/-/glee-0.35.21.tgz", - "integrity": "sha512-D+KyQG5uhNZ+vIfLKCU5qEm1zf8IVNldWdOG29CoV03/xYRIbgFRlGws2OrNzbf1mvDSUbDMrPnDoBlaeGBt5g==", + "version": "0.36.0", + "resolved": "https://registry.npmjs.org/@asyncapi/glee/-/glee-0.36.0.tgz", + "integrity": "sha512-cPuqQm8w8PG09O7dSBhCt84T01m3Lu3wtX4sDISSPHqODW0cao7piK7sNmXHtRLlnR1hiXJ8ZXbxk/M7rtKuxg==", "dependencies": { "@asyncapi/generator": "^1.17.12", "@asyncapi/html-template": "^2.1.4", @@ -12335,9 +12335,9 @@ } }, "@asyncapi/glee": { - "version": "0.35.21", - "resolved": "https://registry.npmjs.org/@asyncapi/glee/-/glee-0.35.21.tgz", - "integrity": "sha512-D+KyQG5uhNZ+vIfLKCU5qEm1zf8IVNldWdOG29CoV03/xYRIbgFRlGws2OrNzbf1mvDSUbDMrPnDoBlaeGBt5g==", + "version": "0.36.0", + "resolved": "https://registry.npmjs.org/@asyncapi/glee/-/glee-0.36.0.tgz", + "integrity": "sha512-cPuqQm8w8PG09O7dSBhCt84T01m3Lu3wtX4sDISSPHqODW0cao7piK7sNmXHtRLlnR1hiXJ8ZXbxk/M7rtKuxg==", "requires": { "@asyncapi/generator": "^1.17.12", "@asyncapi/html-template": "^2.1.4", diff --git a/assets/create-glee-app/templates/default/package.json b/assets/create-glee-app/templates/default/package.json index 06dc93f47f6..e1b5e8ef548 100644 --- a/assets/create-glee-app/templates/default/package.json +++ b/assets/create-glee-app/templates/default/package.json @@ -24,7 +24,7 @@ }, "homepage": "https://github.com/asyncapi/glee-hello-world#readme", "dependencies": { - "@asyncapi/glee": "^0.35.21" + "@asyncapi/glee": "^0.36.0" }, "devDependencies": { "@types/node": "^20.5.9" diff --git a/assets/create-glee-app/templates/tutorial/package-lock.json b/assets/create-glee-app/templates/tutorial/package-lock.json index 21b9a8c9cad..639b6811c25 100644 --- a/assets/create-glee-app/templates/tutorial/package-lock.json +++ b/assets/create-glee-app/templates/tutorial/package-lock.json @@ -9,7 +9,7 @@ "version": "0.1.0", "license": "Apache-2.0", "dependencies": { - "@asyncapi/glee": "^0.35.21" + "@asyncapi/glee": "^0.36.0" }, "engines": { "node": ">=14.15.1" @@ -155,9 +155,9 @@ } }, "node_modules/@asyncapi/glee": { - "version": "0.35.21", - "resolved": "https://registry.npmjs.org/@asyncapi/glee/-/glee-0.35.21.tgz", - "integrity": "sha512-D+KyQG5uhNZ+vIfLKCU5qEm1zf8IVNldWdOG29CoV03/xYRIbgFRlGws2OrNzbf1mvDSUbDMrPnDoBlaeGBt5g==", + "version": "0.36.0", + "resolved": "https://registry.npmjs.org/@asyncapi/glee/-/glee-0.36.0.tgz", + "integrity": "sha512-cPuqQm8w8PG09O7dSBhCt84T01m3Lu3wtX4sDISSPHqODW0cao7piK7sNmXHtRLlnR1hiXJ8ZXbxk/M7rtKuxg==", "dependencies": { "@asyncapi/generator": "^1.17.12", "@asyncapi/html-template": "^2.1.4", diff --git a/assets/create-glee-app/templates/tutorial/package.json b/assets/create-glee-app/templates/tutorial/package.json index 3cd8b7d0582..d42ef704ac8 100644 --- a/assets/create-glee-app/templates/tutorial/package.json +++ b/assets/create-glee-app/templates/tutorial/package.json @@ -16,6 +16,6 @@ "author": "Fran Mendez", "license": "Apache-2.0", "dependencies": { - "@asyncapi/glee": "^0.35.21" + "@asyncapi/glee": "^0.36.0" } } diff --git a/docs/usage.md b/docs/usage.md index 2a0c7c1430c..e2430b5329c 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -29,7 +29,7 @@ $ npm install -g @asyncapi/cli $ asyncapi COMMAND running command... $ asyncapi (--version) -@asyncapi/cli/1.6.13 linux-x64 node-v18.19.1 +@asyncapi/cli/1.6.15 linux-x64 node-v18.19.1 $ asyncapi --help [COMMAND] USAGE $ asyncapi COMMAND @@ -93,7 +93,7 @@ EXAMPLES $ asyncapi bundle ./asyncapi.yaml ./features.yaml --base ./asyncapi.yaml --reference-into-components ``` -_See code: [src/commands/bundle.ts](https://github.com/asyncapi/cli/blob/v1.6.13/src/commands/bundle.ts)_ +_See code: [src/commands/bundle.ts](https://github.com/asyncapi/cli/blob/v1.6.15/src/commands/bundle.ts)_ ## `asyncapi config` @@ -107,7 +107,7 @@ DESCRIPTION CLI config settings ``` -_See code: [src/commands/config/index.ts](https://github.com/asyncapi/cli/blob/v1.6.13/src/commands/config/index.ts)_ +_See code: [src/commands/config/index.ts](https://github.com/asyncapi/cli/blob/v1.6.15/src/commands/config/index.ts)_ ## `asyncapi config context` @@ -121,7 +121,7 @@ DESCRIPTION Manage short aliases for full paths to AsyncAPI documents ``` -_See code: [src/commands/config/context/index.ts](https://github.com/asyncapi/cli/blob/v1.6.13/src/commands/config/context/index.ts)_ +_See code: [src/commands/config/context/index.ts](https://github.com/asyncapi/cli/blob/v1.6.15/src/commands/config/context/index.ts)_ ## `asyncapi config context add CONTEXT-NAME SPEC-FILE-PATH` @@ -143,7 +143,7 @@ DESCRIPTION Add a context to the store ``` -_See code: [src/commands/config/context/add.ts](https://github.com/asyncapi/cli/blob/v1.6.13/src/commands/config/context/add.ts)_ +_See code: [src/commands/config/context/add.ts](https://github.com/asyncapi/cli/blob/v1.6.15/src/commands/config/context/add.ts)_ ## `asyncapi config context current` @@ -160,7 +160,7 @@ DESCRIPTION Shows the current context that is being used ``` -_See code: [src/commands/config/context/current.ts](https://github.com/asyncapi/cli/blob/v1.6.13/src/commands/config/context/current.ts)_ +_See code: [src/commands/config/context/current.ts](https://github.com/asyncapi/cli/blob/v1.6.15/src/commands/config/context/current.ts)_ ## `asyncapi config context edit CONTEXT-NAME NEW-SPEC-FILE-PATH` @@ -181,7 +181,7 @@ DESCRIPTION Edit a context in the store ``` -_See code: [src/commands/config/context/edit.ts](https://github.com/asyncapi/cli/blob/v1.6.13/src/commands/config/context/edit.ts)_ +_See code: [src/commands/config/context/edit.ts](https://github.com/asyncapi/cli/blob/v1.6.15/src/commands/config/context/edit.ts)_ ## `asyncapi config context init [CONTEXT-FILE-PATH]` @@ -204,7 +204,7 @@ DESCRIPTION Initialize context ``` -_See code: [src/commands/config/context/init.ts](https://github.com/asyncapi/cli/blob/v1.6.13/src/commands/config/context/init.ts)_ +_See code: [src/commands/config/context/init.ts](https://github.com/asyncapi/cli/blob/v1.6.15/src/commands/config/context/init.ts)_ ## `asyncapi config context list` @@ -221,7 +221,7 @@ DESCRIPTION List all the stored contexts in the store ``` -_See code: [src/commands/config/context/list.ts](https://github.com/asyncapi/cli/blob/v1.6.13/src/commands/config/context/list.ts)_ +_See code: [src/commands/config/context/list.ts](https://github.com/asyncapi/cli/blob/v1.6.15/src/commands/config/context/list.ts)_ ## `asyncapi config context remove CONTEXT-NAME` @@ -241,7 +241,7 @@ DESCRIPTION Delete a context from the store ``` -_See code: [src/commands/config/context/remove.ts](https://github.com/asyncapi/cli/blob/v1.6.13/src/commands/config/context/remove.ts)_ +_See code: [src/commands/config/context/remove.ts](https://github.com/asyncapi/cli/blob/v1.6.15/src/commands/config/context/remove.ts)_ ## `asyncapi config context use CONTEXT-NAME` @@ -261,7 +261,7 @@ DESCRIPTION Set a context as current ``` -_See code: [src/commands/config/context/use.ts](https://github.com/asyncapi/cli/blob/v1.6.13/src/commands/config/context/use.ts)_ +_See code: [src/commands/config/context/use.ts](https://github.com/asyncapi/cli/blob/v1.6.15/src/commands/config/context/use.ts)_ ## `asyncapi config versions` @@ -278,7 +278,7 @@ DESCRIPTION Show versions of AsyncAPI tools used ``` -_See code: [src/commands/config/versions.ts](https://github.com/asyncapi/cli/blob/v1.6.13/src/commands/config/versions.ts)_ +_See code: [src/commands/config/versions.ts](https://github.com/asyncapi/cli/blob/v1.6.15/src/commands/config/versions.ts)_ ## `asyncapi convert [SPEC-FILE]` @@ -300,7 +300,7 @@ DESCRIPTION Convert asyncapi documents older to newer versions ``` -_See code: [src/commands/convert.ts](https://github.com/asyncapi/cli/blob/v1.6.13/src/commands/convert.ts)_ +_See code: [src/commands/convert.ts](https://github.com/asyncapi/cli/blob/v1.6.15/src/commands/convert.ts)_ ## `asyncapi diff OLD NEW` @@ -355,7 +355,7 @@ DESCRIPTION Find diff between two asyncapi files ``` -_See code: [src/commands/diff.ts](https://github.com/asyncapi/cli/blob/v1.6.13/src/commands/diff.ts)_ +_See code: [src/commands/diff.ts](https://github.com/asyncapi/cli/blob/v1.6.15/src/commands/diff.ts)_ ## `asyncapi generate` @@ -369,7 +369,7 @@ DESCRIPTION Generate typed models or other things like clients, applications or docs using AsyncAPI Generator templates. ``` -_See code: [src/commands/generate/index.ts](https://github.com/asyncapi/cli/blob/v1.6.13/src/commands/generate/index.ts)_ +_See code: [src/commands/generate/index.ts](https://github.com/asyncapi/cli/blob/v1.6.15/src/commands/generate/index.ts)_ ## `asyncapi generate fromTemplate ASYNCAPI TEMPLATE` @@ -406,7 +406,7 @@ EXAMPLES $ asyncapi generate fromTemplate asyncapi.yaml @asyncapi/html-template --param version=1.0.0 singleFile=true --output ./docs --force-write ``` -_See code: [src/commands/generate/fromTemplate.ts](https://github.com/asyncapi/cli/blob/v1.6.13/src/commands/generate/fromTemplate.ts)_ +_See code: [src/commands/generate/fromTemplate.ts](https://github.com/asyncapi/cli/blob/v1.6.15/src/commands/generate/fromTemplate.ts)_ ## `asyncapi generate models LANGUAGE FILE` @@ -490,7 +490,7 @@ DESCRIPTION Generates typed models ``` -_See code: [src/commands/generate/models.ts](https://github.com/asyncapi/cli/blob/v1.6.13/src/commands/generate/models.ts)_ +_See code: [src/commands/generate/models.ts](https://github.com/asyncapi/cli/blob/v1.6.15/src/commands/generate/models.ts)_ ## `asyncapi new` @@ -547,7 +547,7 @@ EXAMPLES $ asyncapi new --file-name=my-asyncapi.yml --example=default-example.yml --no-tty - create a new file with a specific name, using one of the examples and without interactive mode ``` -_See code: [src/commands/new/index.ts](https://github.com/asyncapi/cli/blob/v1.6.13/src/commands/new/index.ts)_ +_See code: [src/commands/new/index.ts](https://github.com/asyncapi/cli/blob/v1.6.15/src/commands/new/index.ts)_ ## `asyncapi new file` @@ -604,7 +604,7 @@ EXAMPLES $ asyncapi new --file-name=my-asyncapi.yml --example=default-example.yml --no-tty - create a new file with a specific name, using one of the examples and without interactive mode ``` -_See code: [src/commands/new/file.ts](https://github.com/asyncapi/cli/blob/v1.6.13/src/commands/new/file.ts)_ +_See code: [src/commands/new/file.ts](https://github.com/asyncapi/cli/blob/v1.6.15/src/commands/new/file.ts)_ ## `asyncapi new glee` @@ -626,7 +626,7 @@ DESCRIPTION Creates a new Glee project ``` -_See code: [src/commands/new/glee.ts](https://github.com/asyncapi/cli/blob/v1.6.13/src/commands/new/glee.ts)_ +_See code: [src/commands/new/glee.ts](https://github.com/asyncapi/cli/blob/v1.6.15/src/commands/new/glee.ts)_ ## `asyncapi new project` @@ -648,7 +648,7 @@ DESCRIPTION Creates a new Glee project ``` -_See code: [src/commands/new/project.ts](https://github.com/asyncapi/cli/blob/v1.6.13/src/commands/new/project.ts)_ +_See code: [src/commands/new/project.ts](https://github.com/asyncapi/cli/blob/v1.6.15/src/commands/new/project.ts)_ ## `asyncapi optimize [SPEC-FILE]` @@ -684,7 +684,7 @@ EXAMPLES $ asyncapi optimize ./asyncapi.yaml --optimization=remove-components,reuse-components,move-to-components --output=terminal --no-tty ``` -_See code: [src/commands/optimize.ts](https://github.com/asyncapi/cli/blob/v1.6.13/src/commands/optimize.ts)_ +_See code: [src/commands/optimize.ts](https://github.com/asyncapi/cli/blob/v1.6.15/src/commands/optimize.ts)_ ## `asyncapi start` @@ -698,7 +698,7 @@ DESCRIPTION Start asyncapi studio ``` -_See code: [src/commands/start/index.ts](https://github.com/asyncapi/cli/blob/v1.6.13/src/commands/start/index.ts)_ +_See code: [src/commands/start/index.ts](https://github.com/asyncapi/cli/blob/v1.6.15/src/commands/start/index.ts)_ ## `asyncapi start studio` @@ -717,7 +717,7 @@ DESCRIPTION starts a new local instance of Studio ``` -_See code: [src/commands/start/studio.ts](https://github.com/asyncapi/cli/blob/v1.6.13/src/commands/start/studio.ts)_ +_See code: [src/commands/start/studio.ts](https://github.com/asyncapi/cli/blob/v1.6.15/src/commands/start/studio.ts)_ ## `asyncapi validate [SPEC-FILE]` @@ -744,5 +744,5 @@ DESCRIPTION validate asyncapi file ``` -_See code: [src/commands/validate.ts](https://github.com/asyncapi/cli/blob/v1.6.13/src/commands/validate.ts)_ +_See code: [src/commands/validate.ts](https://github.com/asyncapi/cli/blob/v1.6.15/src/commands/validate.ts)_ diff --git a/package-lock.json b/package-lock.json index 6dab26b54e3..81cec33f5a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@asyncapi/cli", - "version": "1.6.14", + "version": "1.6.16", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@asyncapi/cli", - "version": "1.6.14", + "version": "1.6.16", "license": "Apache-2.0", "dependencies": { "@asyncapi/avro-schema-parser": "^3.0.17", diff --git a/package.json b/package.json index 1cbbb5b5f00..8127d2d66dd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@asyncapi/cli", "description": "All in one CLI for all AsyncAPI tools", - "version": "1.6.14", + "version": "1.6.16", "author": "@asyncapi", "bin": { "asyncapi": "./bin/run"