From 47e357e36ca9140a8c05b46b4e57b6d00d28884b Mon Sep 17 00:00:00 2001 From: AnimeshKumar923 Date: Sat, 21 Oct 2023 01:28:59 +0530 Subject: [PATCH 1/5] add initial files for the workflow setup --- .github/workflows/update-docs-in-website.yml | 50 +++++++++++++++++++ .../workflows/update-docs-on-docs-commits.yml | 39 +++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 .github/workflows/update-docs-in-website.yml create mode 100644 .github/workflows/update-docs-on-docs-commits.yml diff --git a/.github/workflows/update-docs-in-website.yml b/.github/workflows/update-docs-in-website.yml new file mode 100644 index 000000000..93f34414b --- /dev/null +++ b/.github/workflows/update-docs-in-website.yml @@ -0,0 +1,50 @@ +name: Update latest CLI documentation in the website + +on: + push: + branches: + - 'master' + paths: + - 'docs/*.md' + +jobs: + Make-PR: + name: Make PR on website repository with updated latest CLI documentation + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + steps: + - name: Checkout Current repository + uses: actions/checkout@v3 + with: + path: cli + - name: Checkout Another repository + uses: actions/checkout@v3 + 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 info@asyncapi.io + - name: Create branch + working-directory: ./website + run: | + git checkout -b update-cli-docs-${{ github.sha }} + - name: Copy cli folder from Current Repo to Another + working-directory: ./website + run: | + mkdir -p ./pages/docs/tools/cli + printf "%s\ntitle: CLI\nweight: 10\n%s" "---" "---"> ../cli/docs/_section.md + mv ../cli/docs/*.md ./pages/docs/tools/cli + - name: Commit and push + working-directory: ./website + run: | + git add . + git commit -m "docs(cli): update latest cli docs" + git push https://${{ env.GITHUB_TOKEN }}@github.com/asyncapi/website + - name: Create PR + working-directory: ./website + run: | + gh pr create --title "docs(cli): update latest cli documentation" --body "Updated cli documentation is available and this PR introduces update to cli folder on the website" --head "update-cli-docs-${{ github.sha }}" diff --git a/.github/workflows/update-docs-on-docs-commits.yml b/.github/workflows/update-docs-on-docs-commits.yml new file mode 100644 index 000000000..a57aa2297 --- /dev/null +++ b/.github/workflows/update-docs-on-docs-commits.yml @@ -0,0 +1,39 @@ +name: 'Update generated parts of documentation on docs: commits' + +on: + push: + branches: + - master + +jobs: + docs-gen: + name: 'Generate docs and create PR' + # PR should be created within this GH action only if it is a docs: commit + # Otherwise it will conflict with release workflow + if: startsWith(github.event.commits[0].message, 'docs:') + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + - name: Check package-lock version + uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: "${{ steps.lockversion.outputs.version }}" + - name: Install dependencies + run: npm ci + - name: Regenerate docs + run: npm run generate:assets --if-present + - name: Create Pull Request with updated docs + if: startsWith(github.event.commits[0].message, 'docs:') + uses: peter-evans/create-pull-request@38e0b6e68b4c852a5500a94740f0e535e0d7ba54 # use 4.2.4 https://github.com/peter-evans/create-pull-request/releases/tag/v4.2.4 + with: + token: ${{ secrets.GH_TOKEN }} + commit-message: 'chore: update generated docs' + committer: asyncapi-bot + author: asyncapi-bot + title: 'chore: update generated docs' + body: 'Update of docs that are generated and were forgotten on PR level.' + branch: gen-docs-update + From fbe02953e6f405a889cb9f319119ed9c756e7305 Mon Sep 17 00:00:00 2001 From: AnimeshKumar923 Date: Sat, 21 Oct 2023 01:44:30 +0530 Subject: [PATCH 2/5] adjusted the workflow according to the glee repo Changes: - Made the changes to be in accordance of the glee repository. - Can be modified later according to the feedbacks. --- .github/workflows/update-docs-in-website.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/update-docs-in-website.yml b/.github/workflows/update-docs-in-website.yml index 93f34414b..f9b0ce4f4 100644 --- a/.github/workflows/update-docs-in-website.yml +++ b/.github/workflows/update-docs-in-website.yml @@ -1,4 +1,4 @@ -name: Update latest CLI documentation in the website +name: Update latest Glee documentation in the website on: push: @@ -9,7 +9,7 @@ on: jobs: Make-PR: - name: Make PR on website repository with updated latest CLI documentation + name: Make PR on website repository with updated latest Glee documentation runs-on: ubuntu-latest env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} @@ -17,7 +17,7 @@ jobs: - name: Checkout Current repository uses: actions/checkout@v3 with: - path: cli + path: glee - name: Checkout Another repository uses: actions/checkout@v3 with: @@ -31,20 +31,20 @@ jobs: - name: Create branch working-directory: ./website run: | - git checkout -b update-cli-docs-${{ github.sha }} - - name: Copy cli folder from Current Repo to Another + git checkout -b update-glee-docs-${{ github.sha }} + - name: Copy glee folder from Current Repo to Another working-directory: ./website run: | - mkdir -p ./pages/docs/tools/cli - printf "%s\ntitle: CLI\nweight: 10\n%s" "---" "---"> ../cli/docs/_section.md - mv ../cli/docs/*.md ./pages/docs/tools/cli + mkdir -p ./pages/docs/tools/glee + printf "%s\ntitle: Glee\nweight: 06\n%s" "---" "---"> ../glee/docs/_section.md + mv ../glee/docs/*.md ./pages/docs/tools/glee - name: Commit and push working-directory: ./website run: | git add . - git commit -m "docs(cli): update latest cli docs" + git commit -m "docs(glee): update latest glee docs" git push https://${{ env.GITHUB_TOKEN }}@github.com/asyncapi/website - name: Create PR working-directory: ./website run: | - gh pr create --title "docs(cli): update latest cli documentation" --body "Updated cli documentation is available and this PR introduces update to cli folder on the website" --head "update-cli-docs-${{ github.sha }}" + gh pr create --title "docs(glee): update latest glee documentation" --body "Updated glee documentation is available and this PR introduces update to glee folder on the website" --head "update-glee-docs-${{ github.sha }}" From 4df5c6cdb2414a7cfa6138ba248ba6960ea691f0 Mon Sep 17 00:00:00 2001 From: Animesh Kumar Date: Tue, 31 Oct 2023 23:18:53 +0530 Subject: [PATCH 3/5] Update .github/workflows/update-docs-in-website.yml Changes: - add suggestion from https://github.com/asyncapi/glee/pull/548#discussion_r1377926733 Co-authored-by: Afzal Ansari --- .github/workflows/update-docs-in-website.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-docs-in-website.yml b/.github/workflows/update-docs-in-website.yml index f9b0ce4f4..8cd3cb3ee 100644 --- a/.github/workflows/update-docs-in-website.yml +++ b/.github/workflows/update-docs-in-website.yml @@ -37,7 +37,7 @@ jobs: run: | mkdir -p ./pages/docs/tools/glee printf "%s\ntitle: Glee\nweight: 06\n%s" "---" "---"> ../glee/docs/_section.md - mv ../glee/docs/*.md ./pages/docs/tools/glee + mv ../glee/docs/pages/*.md ./pages/docs/tools/glee - name: Commit and push working-directory: ./website run: | From 494d5b26518b3e12dd39a438d8696e6550bf9dce Mon Sep 17 00:00:00 2001 From: Animesh Kumar Date: Tue, 31 Oct 2023 23:41:06 +0530 Subject: [PATCH 4/5] Delete .github/workflows/update-docs-on-docs-commits.yml Changes: - deleted this workflow because as told by Lukasz because it will be centrally managed in .github repo by https://github.com/asyncapi/.github/issues/242 --- .../workflows/update-docs-on-docs-commits.yml | 39 ------------------- 1 file changed, 39 deletions(-) delete mode 100644 .github/workflows/update-docs-on-docs-commits.yml diff --git a/.github/workflows/update-docs-on-docs-commits.yml b/.github/workflows/update-docs-on-docs-commits.yml deleted file mode 100644 index a57aa2297..000000000 --- a/.github/workflows/update-docs-on-docs-commits.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: 'Update generated parts of documentation on docs: commits' - -on: - push: - branches: - - master - -jobs: - docs-gen: - name: 'Generate docs and create PR' - # PR should be created within this GH action only if it is a docs: commit - # Otherwise it will conflict with release workflow - if: startsWith(github.event.commits[0].message, 'docs:') - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v3 - - name: Check package-lock version - uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: "${{ steps.lockversion.outputs.version }}" - - name: Install dependencies - run: npm ci - - name: Regenerate docs - run: npm run generate:assets --if-present - - name: Create Pull Request with updated docs - if: startsWith(github.event.commits[0].message, 'docs:') - uses: peter-evans/create-pull-request@38e0b6e68b4c852a5500a94740f0e535e0d7ba54 # use 4.2.4 https://github.com/peter-evans/create-pull-request/releases/tag/v4.2.4 - with: - token: ${{ secrets.GH_TOKEN }} - commit-message: 'chore: update generated docs' - committer: asyncapi-bot - author: asyncapi-bot - title: 'chore: update generated docs' - body: 'Update of docs that are generated and were forgotten on PR level.' - branch: gen-docs-update - From a5e1a6165a532f350ba8a91972217493349f8da3 Mon Sep 17 00:00:00 2001 From: Khuda Dad Nomani <32505158+KhudaDad414@users.noreply.github.com> Date: Wed, 1 Nov 2023 13:42:27 +0000 Subject: [PATCH 5/5] Update .github/workflows/update-docs-in-website.yml --- .github/workflows/update-docs-in-website.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-docs-in-website.yml b/.github/workflows/update-docs-in-website.yml index 8cd3cb3ee..6f3bba422 100644 --- a/.github/workflows/update-docs-in-website.yml +++ b/.github/workflows/update-docs-in-website.yml @@ -5,7 +5,7 @@ on: branches: - 'master' paths: - - 'docs/*.md' + - 'docs/pages/*.md' jobs: Make-PR: