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

ci: add workflow file for updating docs in website #258

Merged
merged 15 commits into from
Sep 16, 2024
121 changes: 121 additions & 0 deletions .github/workflows/update-docs-in-website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: Update latest Bindings documentation in the website

on:
push:
branches:
- master
paths:
- "**/*.md"
workflow_dispatch:

jobs:
Make-PR:
name: Make PR on website repository with updated latest Bindings documentation
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- name: Checkout Current repository
uses: actions/checkout@v4
with:
path: bindings
- name: Checkout Another repository
uses: actions/checkout@v4
with:
repository: asyncapi/website
path: website
token: ${{ env.GITHUB_TOKEN }}
- name: Config git
run: |
git config --global user.name asyncapi-bot
git config --global user.email [email protected]
- name: Create branch
working-directory: ./website
run: |
git checkout -b update-bindings-docs-${{ github.sha }}
- name: Update edit-page-config.json
uses: actions/github-script@v4
with:
script: |
const { writeFile } = require('fs').promises;
const configPath = './website/config/edit-page-config.json';
const checkSlug = 'reference/bindings/';
const slug = {
"value": checkSlug,
"href": "https://github.com/asyncapi/bindings/tree/master"
derberg marked this conversation as resolved.
Show resolved Hide resolved
};

const configData = require(configPath);
const entryExists = configData.some(entry => entry.value === checkSlug);
if (!entryExists) {
configData.unshift(slug);
await writeFile(configPath, JSON.stringify(configData, null, 2))
}

- name: Update title and weight of the markdown files
uses: actions/github-script@v4
with:
script: |
const fs = require('fs');
const path = require('path');
const rootPath = './bindings/';
let itemIndex = 10;

function processMarkdownFiles(folderPath, isRoot = true) {
const items = fs.readdirSync(folderPath, { withFileTypes: true });
for (const item of items) {
const fullPath = path.join(folderPath, item.name);
if (item.isDirectory()) {
// Always process subdirectories, mark isRoot as false for recursive calls
processMarkdownFiles(fullPath, false);
} else if (item.name.endsWith('.md') && !isRoot) { // Skip root level .md files
const baseName = path.basename(fullPath, '.md');
const parentDirName = path.basename(folderPath);
const newFileName = `${parentDirName}.md`;
const newFullPath = path.join(folderPath, newFileName);
fs.renameSync(fullPath, newFullPath);

const newData = `---\ntitle: '${parentDirName}'\nweight: ${itemIndex}\n---\n\n`;
let existingFileData = fs.readFileSync(newFullPath, 'utf8');

existingFileData = existingFileData.replace(/<img\s+src="(?!http)(.*?)"/g, (match, src) => {
// Remove './' prefix from src path and prepend '/img/docs/'
const updatedSrc = src.replace(/^\.\//, '');
return `<img src="/img/docs/${updatedSrc}"`;
});

const updatedContent = newData + existingFileData;
fs.writeFileSync(newFullPath, updatedContent);
itemIndex++;
}
}
}

await processMarkdownFiles(rootPath);

- name: Copy bindings folder from Current Repo to Another
working-directory: ./website
run: |
mkdir -p ./markdown/docs/reference/bindings
printf "%s\ntitle: Bindings\nweight: 11\n%s" "---" "---"> ../bindings/_section.md
find ../bindings -type f -name '*.md' ! -name 'CONTRIBUTING.md' ! -name 'README.md' ! -name 'CODE_OF_CONDUCT.md' -exec mv {} ./markdown/docs/reference/bindings/ \;

- name: Copy images to website
run: |
# Assuming the workflow runs on Linux/macOS
# Create the target directory if it doesn't exist
mkdir -p ./website/public/img/docs/
# Find and copy all image files from the source directory to the target directory
find ./bindings/ -type f \( -iname "*.png" -o -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.gif" -iname "*.webp" \) -exec cp {} ./website/public/img/docs/ \;

- name: Commit and push
working-directory: ./website
run: |
git add .
git commit -m "docs(extension): update latest bindings docs"
git push https://${{ env.GITHUB_TOKEN }}@github.com/asyncapi/website

- name: Create PR
working-directory: ./website
run: |
gh pr create --title "docs(bindings): update latest bindings documentation" --body "Updated bindings documentation is available and this PR introduces update to bindings folder on the website" --head "update-bindings-docs-${{ github.sha }}"
16 changes: 8 additions & 8 deletions ibmmq/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,14 @@ Field Name | Type | Description | Applicability [default] | Constraints
---|:---:|---|:---|:---
<a name="channelBindingObjectDestinationType"></a>`destinationType` | string | Defines the type of AsyncAPI channel. | OPTIONAL [`topic`] | MUST be either `topic` or `queue`. For type `topic`, the AsyncAPI channel name MUST be assumed for the IBM MQ topic string unless overridden.
<a name="channelBindingObjectQueue"></a>`queue` | Map[string, any] | Defines the properties of a queue. | REQUIRED if `destinationType` = `queue` | `queue` and `topic` fields MUST NOT coexist within a channel binding
<a name="channelBindingObjectQueueObjectName"></a>`queue.`<br>`objectName`</br> | string | Defines the name of the IBM MQ queue associated with the channel. | REQUIRED | A value MUST be specified. MUST NOT exceed 48 characters in length. MUST be a valid IBM MQ queue name
<a name="channelBindingObjectisPartitioned"></a>`queue.`<br>`isPartitioned`</br> | boolean | Defines if the queue is a cluster queue and therefore partitioned. If `true`, a binding option MAY be specified when accessing the queue. More information on binding options can be found on this [page](https://www.ibm.com/support/knowledgecenter/SSFKSJ_latest/com.ibm.mq.ref.dev.doc/q101870_.html#q101870___BIND_ON_OPEN) in the IBM MQ Knowledge Center. | OPTIONAL [`false`] | If `false`, binding options SHOULD NOT be specified when accessing the queue.
<a name="channelBindingObjectQueueExclusive"></a>`queue.`<br>`exclusive`</br> | boolean | Specifies if it is recommended to open the queue exclusively. | OPTIONAL [`false`] | -
<a name="channelBindingObjectQueueObjectName"></a>`queue.`<br />`objectName` | string | Defines the name of the IBM MQ queue associated with the channel. | REQUIRED | A value MUST be specified. MUST NOT exceed 48 characters in length. MUST be a valid IBM MQ queue name
<a name="channelBindingObjectisPartitioned"></a>`queue.`<br />`isPartitioned` | boolean | Defines if the queue is a cluster queue and therefore partitioned. If `true`, a binding option MAY be specified when accessing the queue. More information on binding options can be found on this [page](https://www.ibm.com/support/knowledgecenter/SSFKSJ_latest/com.ibm.mq.ref.dev.doc/q101870_.html#q101870___BIND_ON_OPEN) in the IBM MQ Knowledge Center. | OPTIONAL [`false`] | If `false`, binding options SHOULD NOT be specified when accessing the queue.
<a name="channelBindingObjectQueueExclusive"></a>`queue.`<br />`exclusive` | boolean | Specifies if it is recommended to open the queue exclusively. | OPTIONAL [`false`] | -
<a name="channelBindingObjectTopic"></a>`topic` | Map[string, any] | Defines the properties of a topic. | OPTIONAL if `destinationType` = `topic` | `queue` and `topic` fields MUST NOT coexist within a channel binding.
<a name="channelBindingObjectTopicString"></a>`topic.`<br>`string`</br> | string | The value of the IBM MQ topic string to be used. | OPTIONAL *<br>Note: if specified, SHALL override AsyncAPI channel name.</br>* | MUST NOT exceed 10240 characters in length. MAY coexist with `topic.objectName`
<a name="channelBindingObjectTopicObjectName"></a>`topic.`<br>`objectName`</br> | string | The name of the IBM MQ topic object. | OPTIONAL *<br>Note: if specified, SHALL override AsyncAPI channel name.</br>*| MUST NOT exceed 48 characters in length. MAY coexist with `topic.string`
<a name="channelBindingObjectTopicDurablePermitted"></a>`topic.`<br> `durablePermitted`</br> | boolean | Defines if the subscription may be durable. | OPTIONAL [`true`] | -
<a name="channelBindingObjectTopicLastMsgRetained"></a>`topic.`<br>`lastMsgRetained`</br> | boolean | Defines if the last message published will be made available to new subscriptions. | OPTIONAL [`false`] | -
<a name="channelBindingObjectTopicString"></a>`topic.`<br />`string` | string | The value of the IBM MQ topic string to be used. | OPTIONAL *<br />Note: if specified, SHALL override AsyncAPI channel name.* | MUST NOT exceed 10240 characters in length. MAY coexist with `topic.objectName`
<a name="channelBindingObjectTopicObjectName"></a>`topic.`<br />`objectName` | string | The name of the IBM MQ topic object. | OPTIONAL *<br />Note: if specified, SHALL override AsyncAPI channel name.*| MUST NOT exceed 48 characters in length. MAY coexist with `topic.string`
<a name="channelBindingObjectTopicDurablePermitted"></a>`topic.`<br /> `durablePermitted` | boolean | Defines if the subscription may be durable. | OPTIONAL [`true`] | -
<a name="channelBindingObjectTopicLastMsgRetained"></a>`topic.`<br />`lastMsgRetained` | boolean | Defines if the last message published will be made available to new subscriptions. | OPTIONAL [`false`] | -
<a name="channelBindingObjectMaxMsgLength"></a>`maxMsgLength` | integer | The maximum length of the physical message (in bytes) accepted by the Topic or Queue. Messages produced that are greater in size than this value may fail to be delivered. More information on the maximum message length can be found on this [page](https://www.ibm.com/support/knowledgecenter/SSFKSJ_latest/com.ibm.mq.ref.adm.doc/q085520_.html#q085520___maxmsgl) in the IBM MQ Knowledge Center. | OPTIONAL [negotiated on IBM MQ channel]| MUST be `0-104,857,600` bytes (100 MB).
<a name="channelBindingObjectBindingVersion"></a>`bindingVersion` | string | The version of this binding. | OPTIONAL [`latest`] | -

Expand Down Expand Up @@ -226,7 +226,7 @@ Field Name | Type | Description | Applicability [default] | Constraints
---|:---:|---|:---|:---
<a name="messageBindingObjectType"></a>`type` | string | The type of the message. | OPTIONAL [`string`] | MUST be either `string`, `jms` or `binary`
<a name="messageBindingObjectHeaders"></a>`headers` | string | Defines the IBM MQ message headers to include with this message. More than one header can be specified as a comma separated list. Supporting information on IBM MQ message formats can be found on this [page](https://www.ibm.com/support/knowledgecenter/SSFKSJ_latest/com.ibm.mq.ref.dev.doc/q097520_.html) in the IBM MQ Knowledge Center. | OPTIONAL if `type` = `binary` | `headers` MUST NOT be specified if `type` = `string` or `jms`
<a name="messageBindingObjectDescription"></a>`description` | string<sup>1</sub> | Provides additional information for application developers: describes the message type or format. | OPTIONAL | -
<a name="messageBindingObjectDescription"></a>`description` | string<sup>1</sup> | Provides additional information for application developers: describes the message type or format. | OPTIONAL | -
<a name="messageBindingObjectExpiry"></a>`expiry` | integer | The recommended setting the client should use for the TTL (Time-To-Live) of the message. This is a period of time expressed in milliseconds and set by the application that puts the message. `expiry` values are API dependant e.g., MQI and JMS use different units of time and default values for *`unlimited`*. General information on IBM MQ message expiry can be found on this [page](https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_latest/com.ibm.mq.ref.dev.doc/q097490_.html) in the IBM MQ Knowledge Center. | OPTIONAL [*`unlimited`*] | `expiry` value MUST be either `zero` (*`unlimited`*) or greater than zero.
<a name="messageBindingObjectBindingVersion"></a>`bindingVersion` | string | The version of this binding. | OPTIONAL [`latest`] | -

Expand Down
12 changes: 6 additions & 6 deletions sns/2.x.x/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ We support an array of consumers via the **consumers** field. This allows you to
| <a name="channelBindingDeliveryPolicyObjectMaxReceivesPerSecond"></a>`maxReceivesPerSecond` | integer | **Optional.** The maximum number of deliveries per second, per subscription |

#### Identifier
|Field Name | Type | Description|
|---|:---:|---|
|<a name="identifierObjectUrl"></a>`url` |string| **Optional.** The endpoint is a URL |
|<a name="identifierObjectEmail"></a>`email` |string| **Optional.** The endpoint is an email address |
|<a name="identifierObjectPhone"></a>`phone` |string| **Optional.** The endpoint is a phone number|
|<a name="identifierObjectArn"></a>`arn` |string| **Optional.** The target is an [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). For example, for SQS, the identifier may be an ARN, which will be of the form: ["arn:aws:sqs:{region}:{account-id}:{queueName}"](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)|
|Field Name | Type | Description |
|---|:---:|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|<a name="identifierObjectUrl"></a>`url` |string| **Optional.** The endpoint is a URL |
|<a name="identifierObjectEmail"></a>`email` |string| **Optional.** The endpoint is an email address |
|<a name="identifierObjectPhone"></a>`phone` |string| **Optional.** The endpoint is a phone number |
|<a name="identifierObjectArn"></a>`arn` |string| **Optional.** The target is an [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). For example, for SQS, the identifier may be an ARN, which will be of the form: ["arn:aws:sqs:\{region}:\{account-id}:\{queueName}"](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) |
|<a name="identifierObjectName"></a>`name` |string| **Optional.** The endpoint is identified by a name, which corresponds to an identifying field called 'name' of a binding for that protocol on this **publish** Operation Object. For example, if the protocol is 'sqs' then the name refers to the name field **sqs** binding. We don't use $ref because we are referring, not including. |

We provide an Identifer Object to support providing the identifier of an externally defined endpoint for this SNS *publication* to target, or an endpoint on another binding against this Operation Object (via the name field).
Expand Down
8 changes: 4 additions & 4 deletions sqs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ An SQS queue can set up a Dead Letter Queue as part of a Redelivery Policy. To s
| <a name="queueObjectTags"></a>`tags` |Object | **Optional.** Key-value pairs that represent AWS tags on the queue. |

#### Identifier
|Field Name | Type | Description|
|---|:---:|---|
|<a name="identifierObjectArn"></a>`arn` |string| **Optional.** The target is an [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). For example, for SQS, the identifier may be an ARN, which will be of the form: ["arn:aws:sqs:{region}:{account-id}:{queueName}"](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)|
|<a name="identifierObjectName"></a>`name` |string| **Optional.** The endpoint is identified by a name, which corresponds to an identifying field called 'name' of a binding for that protocol on this **publish** Operation Object. For example, if the protocol is 'sqs' then the name refers to the name field **sqs** binding|
|Field Name | Type | Description |
|---|:---:|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|<a name="identifierObjectArn"></a>`arn` |string| **Optional.** The target is an [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). For example, for SQS, the identifier may be an ARN, which will be of the form: ["arn:aws:sqs:\{region}:\{account-id}:\{queueName}"](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) |
|<a name="identifierObjectName"></a>`name` |string| **Optional.** The endpoint is identified by a name, which corresponds to an identifying field called 'name' of a binding for that protocol on this **publish** Operation Object. For example, if the protocol is 'sqs' then the name refers to the name field **sqs** binding |

#### Policy
|Field Name | Type | Description|
Expand Down
Loading