From 4e2892b6c2907341cc73b9eba9229355d8e82955 Mon Sep 17 00:00:00 2001 From: Adish M Date: Wed, 3 May 2023 20:03:49 +0530 Subject: [PATCH 1/5] Automation for creation versioned docs --- .github/workflows/doc-release.yml | 66 +++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/doc-release.yml diff --git a/.github/workflows/doc-release.yml b/.github/workflows/doc-release.yml new file mode 100644 index 0000000000..a006c3f9c5 --- /dev/null +++ b/.github/workflows/doc-release.yml @@ -0,0 +1,66 @@ +name: Documentation version release + +on: + workflow_dispatch: + inputs: + create-branch: + description: "Branch name" + version: + description: "RELEASE_VERSION" + +jobs: + versioned-docs: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Create new branch + if: "${{ github.event.inputs.create-branch != '' }}" + run: | + git checkout -b "${{ github.event.inputs.create-branch }}" + + - name: Creating a new doc version + if: "${{ github.event.inputs.RELEASE_VERSION != '' }}" + with: + working-directory: ./docs/ + run: | + npm run docusaurus docs:"${{ github.event.inputs.RELEASE_VERSION }}" + + - name: Commit changes and push + run: | + git config user.email "adish.madhu@gmail.com" + git config user.name "adishM98" + git add -A + git commit -m "created new version folder" + git push --set-upstream origin "${{ github.event.inputs.create-branch }}" + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3.9.2 + with: + title: "Creating a new version folder" + body: "Created a new version folder for version: ${{ github.event.inputs.RELEASE_VERSION }}" + branch: "${{ github.event.inputs.create-branch }}" + base: "develop" + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Auto-approve and merge Pull Request + uses: marvinpinto/action-auto-approve@v2.0.1 + if: success() + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + pull-request-number: ${{ steps.create-pull-request.outputs.pull-request-number }} + + - name: Merge Pull Request + uses: peter-evans/merge-pull-request@v1.1.0 + if: success() && steps.auto-approve-and-merge.outputs.approved == 'true' + with: + commit-message: "Merge pull request #${{ steps.create-pull-request.outputs.pull-request-number }}: Created a new version folder" + github-token: ${{ secrets.GITHUB_TOKEN }} + pull-request-number: ${{ steps.create-pull-request.outputs.pull-request-number }} + + + + + + From 5c4e2a1952ed819244b5b40ff279b66eedcf4a81 Mon Sep 17 00:00:00 2001 From: Adish M Date: Thu, 4 May 2023 14:55:47 +0530 Subject: [PATCH 2/5] changes for running npm command --- .github/workflows/doc-release.yml | 78 ++++++++++--------------------- 1 file changed, 24 insertions(+), 54 deletions(-) diff --git a/.github/workflows/doc-release.yml b/.github/workflows/doc-release.yml index a006c3f9c5..6539f3fef5 100644 --- a/.github/workflows/doc-release.yml +++ b/.github/workflows/doc-release.yml @@ -9,58 +9,28 @@ on: description: "RELEASE_VERSION" jobs: - versioned-docs: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Create new branch - if: "${{ github.event.inputs.create-branch != '' }}" - run: | - git checkout -b "${{ github.event.inputs.create-branch }}" - - - name: Creating a new doc version - if: "${{ github.event.inputs.RELEASE_VERSION != '' }}" - with: - working-directory: ./docs/ - run: | - npm run docusaurus docs:"${{ github.event.inputs.RELEASE_VERSION }}" - - - name: Commit changes and push - run: | - git config user.email "adish.madhu@gmail.com" - git config user.name "adishM98" - git add -A - git commit -m "created new version folder" - git push --set-upstream origin "${{ github.event.inputs.create-branch }}" - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v3.9.2 - with: - title: "Creating a new version folder" - body: "Created a new version folder for version: ${{ github.event.inputs.RELEASE_VERSION }}" - branch: "${{ github.event.inputs.create-branch }}" - base: "develop" - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Auto-approve and merge Pull Request - uses: marvinpinto/action-auto-approve@v2.0.1 - if: success() - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - pull-request-number: ${{ steps.create-pull-request.outputs.pull-request-number }} - - - name: Merge Pull Request - uses: peter-evans/merge-pull-request@v1.1.0 - if: success() && steps.auto-approve-and-merge.outputs.approved == 'true' - with: - commit-message: "Merge pull request #${{ steps.create-pull-request.outputs.pull-request-number }}: Created a new version folder" - github-token: ${{ secrets.GITHUB_TOKEN }} - pull-request-number: ${{ steps.create-pull-request.outputs.pull-request-number }} - - - - - + build: + runs-on: ubuntu-20.04 + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup node 16.14 + uses: actions/setup-node@v2 + with: + node-version: 16.14 + - run: cd docs && yarn install && npm run docusaurus docs:v2.6 + + - name: extract git commmit data + uses: rlespinasse/git-commit-data-action@v1 + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3.9.2 + with: + title: "Creating a new version folder" + body: "Created a new version folder for version: ${{ github.event.inputs.RELEASE_VERSION }}" + branch: "${{ github.event.inputs.create-branch }}" + base: "develop" + token: ${{ secrets.GITHUB_TOKEN }} + delete-branch : true \ No newline at end of file From 357fdaf88e29bb3232dad576865853c671383bff Mon Sep 17 00:00:00 2001 From: Adish M Date: Thu, 4 May 2023 19:23:49 +0530 Subject: [PATCH 3/5] added code for approving and merging pr --- .github/workflows/doc-release.yml | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/workflows/doc-release.yml b/.github/workflows/doc-release.yml index 6539f3fef5..8f9170ce45 100644 --- a/.github/workflows/doc-release.yml +++ b/.github/workflows/doc-release.yml @@ -10,7 +10,7 @@ on: jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Checkout code @@ -20,17 +20,36 @@ jobs: uses: actions/setup-node@v2 with: node-version: 16.14 - - run: cd docs && yarn install && npm run docusaurus docs:v2.6 + - run: cd docs && yarn install && npm run docusaurus docs:version "${{ github.event.inputs.RELEASE_VERSION }}" - name: extract git commmit data uses: rlespinasse/git-commit-data-action@v1 - name: Create Pull Request + id: doc uses: peter-evans/create-pull-request@v3.9.2 with: title: "Creating a new version folder" body: "Created a new version folder for version: ${{ github.event.inputs.RELEASE_VERSION }}" - branch: "${{ github.event.inputs.create-branch }}" + branch: ${{ github.event.inputs.create-branch }} base: "develop" token: ${{ secrets.GITHUB_TOKEN }} - delete-branch : true \ No newline at end of file + delete-branch : true + + - name: Approve Pull request + uses: juliangruber/approve-pull-request-action@v2 + with: + pull-request-number: ${{ steps.doc.output.pull-request-number }} + + - name: Merge Pull request + uses: juliangruber/approve-pull-request-action@v2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + number: ${{ steps.doc.output.pull-request-number }} + method: sqaush + + + + + + From a1c526e61eeec94cf21ac616eebd8d5d9bd16638 Mon Sep 17 00:00:00 2001 From: Adish M Date: Fri, 5 May 2023 11:36:12 +0530 Subject: [PATCH 4/5] correction in code --- .github/workflows/doc-release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/doc-release.yml b/.github/workflows/doc-release.yml index 8f9170ce45..1d3fd881f8 100644 --- a/.github/workflows/doc-release.yml +++ b/.github/workflows/doc-release.yml @@ -20,7 +20,7 @@ jobs: uses: actions/setup-node@v2 with: node-version: 16.14 - - run: cd docs && yarn install && npm run docusaurus docs:version "${{ github.event.inputs.RELEASE_VERSION }}" + - run: cd docs && yarn install && npm run docusaurus docs:version ${{ github.event.inputs.version }} - name: extract git commmit data uses: rlespinasse/git-commit-data-action@v1 @@ -29,8 +29,8 @@ jobs: id: doc uses: peter-evans/create-pull-request@v3.9.2 with: - title: "Creating a new version folder" - body: "Created a new version folder for version: ${{ github.event.inputs.RELEASE_VERSION }}" + title: "Creating a new version folder ${{ github.event.version }}" + body: "Created a new version folder for version: ${{ github.event.inputs.version }}" branch: ${{ github.event.inputs.create-branch }} base: "develop" token: ${{ secrets.GITHUB_TOKEN }} From bc17485f81fd89000ce30c917e9584917f405673 Mon Sep 17 00:00:00 2001 From: Adish M Date: Fri, 5 May 2023 17:29:47 +0530 Subject: [PATCH 5/5] final code change --- .github/workflows/doc-release.yml | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/.github/workflows/doc-release.yml b/.github/workflows/doc-release.yml index 1d3fd881f8..2574d105a8 100644 --- a/.github/workflows/doc-release.yml +++ b/.github/workflows/doc-release.yml @@ -14,42 +14,26 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup node 16.14 uses: actions/setup-node@v2 with: node-version: 16.14 - run: cd docs && yarn install && npm run docusaurus docs:version ${{ github.event.inputs.version }} - - - name: extract git commmit data - uses: rlespinasse/git-commit-data-action@v1 - name: Create Pull Request id: doc - uses: peter-evans/create-pull-request@v3.9.2 + uses: peter-evans/create-pull-request@v5 with: title: "Creating a new version folder ${{ github.event.version }}" body: "Created a new version folder for version: ${{ github.event.inputs.version }}" branch: ${{ github.event.inputs.create-branch }} base: "develop" - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.GITHUB }} delete-branch : true - - - name: Approve Pull request - uses: juliangruber/approve-pull-request-action@v2 - with: - pull-request-number: ${{ steps.doc.output.pull-request-number }} - - - name: Merge Pull request - uses: juliangruber/approve-pull-request-action@v2 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - number: ${{ steps.doc.output.pull-request-number }} - method: sqaush - - - + labels: versioned-docs, automated pr + commit-message: added new version folder