From e7d9f9cd33ddf96bae7f2f18aa3e6ac2d31fb12d Mon Sep 17 00:00:00 2001 From: Prati28 Date: Tue, 22 Oct 2024 16:14:52 +0530 Subject: [PATCH 1/3] added github action for creating pr Signed-off-by: Prati28 --- .github/workflows/publish-doc.yml | 82 +++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 .github/workflows/publish-doc.yml diff --git a/.github/workflows/publish-doc.yml b/.github/workflows/publish-doc.yml new file mode 100644 index 000000000..5bcaf64fc --- /dev/null +++ b/.github/workflows/publish-doc.yml @@ -0,0 +1,82 @@ +name: ci + +on: + push: + tags: + - v* + +permissions: + contents: write + pull-requests: write + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: actions/setup-python@v4 + with: + python-version: 3.x + + - uses: actions/cache@v2 + with: + key: ${{ github.ref }} + path: .cache + + - name: Install Python dependencies + run: pip install -r ./docs/pip-requirements.txt + + - name: Configure git user + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + + - name: Deploy docs + run: | + VERSION=${{ github.ref }} + VERSION=${VERSION#refs/tags/} + BASE_VERSION=${VERSION#v} + + echo "Deploying documentation for version: $BASE_VERSION" + + cd docs + mike deploy --update-aliases $BASE_VERSION latest + + - name: Create PR for gh-pages + id: create_pr + run: | + VERSION=${{ github.ref }} + VERSION=${VERSION#refs/tags/} + BASE_VERSION=${VERSION#v} + + echo "Documentation for version: $BASE_VERSION" + + git fetch origin gh-pages + + BRANCH_NAME="update-docs-${{ github.run_id }}" + git checkout -b $BRANCH_NAME origin/gh-pages + + # Ensure the local branch is up to date + git pull origin gh-pages + + mkdir -p "./$BASE_VERSION" && cp -r /home/runner/work/caliper/caliper/docs/build/* "./$BASE_VERSION" + + git add . + git commit -m "Update documentation for version $BASE_VERSION" + + git push origin $BRANCH_NAME --force # Use force to avoid non-fast-forward issues + + echo "Creating pull request..." + PR_URL=$(gh pr create --base gh-pages --head $BRANCH_NAME --title "Update documentation for version $BASE_VERSION" --body "This PR updates the documentation for version $BASE_VERSION.") + echo "::set-output name=pr_url::$PR_URL" + + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Notify about PR + run: echo "Pull request created ${{ steps.create_pr.outputs.pr_url }}" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From be5c3095a1c62c7a79751fd308e8f54c772d24b3 Mon Sep 17 00:00:00 2001 From: Prati28 Date: Sat, 16 Nov 2024 12:39:20 +0530 Subject: [PATCH 2/3] made changes Signed-off-by: Prati28 --- .github/workflows/publish-doc.yml | 50 ++++++++++++++++--------------- RELEASE_PROCESS.md | 39 ++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 24 deletions(-) diff --git a/.github/workflows/publish-doc.yml b/.github/workflows/publish-doc.yml index 5bcaf64fc..b1b6ce245 100644 --- a/.github/workflows/publish-doc.yml +++ b/.github/workflows/publish-doc.yml @@ -16,61 +16,63 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - + - uses: actions/setup-python@v4 with: python-version: 3.x - + - uses: actions/cache@v2 with: key: ${{ github.ref }} path: .cache - + - name: Install Python dependencies run: pip install -r ./docs/pip-requirements.txt - + - name: Configure git user run: | git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" - - name: Deploy docs + - name: Deploy docs to gh-pages run: | VERSION=${{ github.ref }} VERSION=${VERSION#refs/tags/} BASE_VERSION=${VERSION#v} - + echo "Deploying documentation for version: $BASE_VERSION" cd docs mike deploy --update-aliases $BASE_VERSION latest - - name: Create PR for gh-pages + cd .. + git fetch origin gh-pages + git checkout gh-pages + git pull origin gh-pages + + mkdir -p "./$BASE_VERSION" && cp -r docs/build/* "./$BASE_VERSION" + + git add . + git commit -m "Update documentation for version $BASE_VERSION" + git push origin gh-pages + + - name: Create PR for updating docs folder in main branch id: create_pr run: | VERSION=${{ github.ref }} VERSION=${VERSION#refs/tags/} BASE_VERSION=${VERSION#v} - echo "Documentation for version: $BASE_VERSION" - - git fetch origin gh-pages - - BRANCH_NAME="update-docs-${{ github.run_id }}" - git checkout -b $BRANCH_NAME origin/gh-pages - - # Ensure the local branch is up to date - git pull origin gh-pages + BRANCH_NAME="update-docs-${{ BASE_VERSION }}" + git checkout -b $BRANCH_NAME - mkdir -p "./$BASE_VERSION" && cp -r /home/runner/work/caliper/caliper/docs/build/* "./$BASE_VERSION" + cp -r docs/* docs/ - git add . - git commit -m "Update documentation for version $BASE_VERSION" + git add docs + git commit -m "Update docs folder for version $BASE_VERSION" + git push origin $BRANCH_NAME - git push origin $BRANCH_NAME --force # Use force to avoid non-fast-forward issues - - echo "Creating pull request..." - PR_URL=$(gh pr create --base gh-pages --head $BRANCH_NAME --title "Update documentation for version $BASE_VERSION" --body "This PR updates the documentation for version $BASE_VERSION.") + PR_URL=$(gh pr create --base main --head $BRANCH_NAME --title "Update docs for version $BASE_VERSION" --body "This PR updates the documentation for version $BASE_VERSION.") echo "::set-output name=pr_url::$PR_URL" env: @@ -79,4 +81,4 @@ jobs: - name: Notify about PR run: echo "Pull request created ${{ steps.create_pr.outputs.pr_url }}" env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/RELEASE_PROCESS.md b/RELEASE_PROCESS.md index be9071f06..c2ced6409 100644 --- a/RELEASE_PROCESS.md +++ b/RELEASE_PROCESS.md @@ -13,4 +13,43 @@ ## Caliper benchmarks 1. Create a release in caliper-benchmarks corresponding to the new release, eg 0.7.0 +## Documentation Deployment +This repository uses GitHub Actions to automate the deployment of documentation to GitHub Pages whenever a new version is tagged. Follow the steps below to change the version and deploy updated documentation. + +### Steps to Change Version and Deploy Documentation + +1. Create a Git Tag for the New Version + +To deploy a new version of the documentation, start by creating a Git tag. For example: + +```bash +git tag v1.2 +``` + +2. Push the Tag to GitHub +Once the tag is created, push it to GitHub: + +```bash +git push origin v1.2.3 +``` + +Pushing the tag will automatically trigger the GitHub Actions CI pipeline defined in the .github/workflows/publish-doc.yml file. + +3. CI Pipeline Actions +When the tag is pushed, the CI pipeline will execute the following steps: + +Checkout Code: The latest version of the repository is pulled. +Setup Python: Python 3.x is set up and the required dependencies are installed from the docs/pip-requirements.txt. +Deploy Documentation: The mike deploy command is used to deploy the documentation to the gh-pages branch under the new version folder (/v1.2.3/). +Create Pull Request: A new branch is created to update the docs folder, and a pull request is opened to merge the changes into the main branch. + +4. Merge the Pull Request +After the pull request is created, review the changes and merge it into the main branch. This ensures the documentation for the new version is available on the main repository. + +5. Access the Documentation +Once the pull request is merged, the updated documentation can be accessed through GitHub Pages. The URL format will be: + +```bash +https://hyperledger-caliper.github.io/caliper/ +``` \ No newline at end of file From 017138e8635b8ae5f51b6cb502a6d7f878da7360 Mon Sep 17 00:00:00 2001 From: Prati28 Date: Tue, 26 Nov 2024 19:24:13 +0530 Subject: [PATCH 3/3] changes Signed-off-by: Prati28 --- .github/workflows/publish-doc.yml | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/.github/workflows/publish-doc.yml b/.github/workflows/publish-doc.yml index b1b6ce245..a093ca148 100644 --- a/.github/workflows/publish-doc.yml +++ b/.github/workflows/publish-doc.yml @@ -55,29 +55,7 @@ jobs: git add . git commit -m "Update documentation for version $BASE_VERSION" git push origin gh-pages - - - name: Create PR for updating docs folder in main branch - id: create_pr - run: | - VERSION=${{ github.ref }} - VERSION=${VERSION#refs/tags/} - BASE_VERSION=${VERSION#v} - - BRANCH_NAME="update-docs-${{ BASE_VERSION }}" - git checkout -b $BRANCH_NAME - - cp -r docs/* docs/ - - git add docs - git commit -m "Update docs folder for version $BASE_VERSION" - git push origin $BRANCH_NAME - - PR_URL=$(gh pr create --base main --head $BRANCH_NAME --title "Update docs for version $BASE_VERSION" --body "This PR updates the documentation for version $BASE_VERSION.") - echo "::set-output name=pr_url::$PR_URL" - - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - + - name: Notify about PR run: echo "Pull request created ${{ steps.create_pr.outputs.pr_url }}" env: