Skip to content

[SDK] spike: find a better way of publishing docs to GitBook #3483

Closed

Description

@dnechay

Is your feature request related to a problem? Please describe.
Atm when publishing new SDK version we have to create a new branch that corresponds to version tag, create a new "doc collection" in GitBook space, then fully sync GitHub repo from the created branch to created collection and set it to latest version. This process is not only doesn't have any instruction, but also implicit by it's nature, seems to be heavy-weight and also pollutes our repository with unnecessary branches (we don't use them for overall releases, i.e. we don't checkout from these branches for hotfixes on old versions, we use just to publish docs).

Describe the solution you'd like
The expected solution should be simpler. Ideally syncing version tag and docs, but not sure it's possible, so this spike is to investigate possible solutions and then we pick one that is a good fit.

Describe alternatives you've considered
TBD by the spike engineer

Additional context
Might make sense to work on this together w/ #3424 as it's kinda related

Activity

  1. self-assigned this
    on Aug 13, 2025
  2. dnechay commented on Sep 2, 2025

    @dnechay
    MemberAuthor

    Did some research on it. We can use an automated way by triggering Gitbook space creating via API and then importing it from git tag ref instead of a branch via API endpoint they have. It's a one-time import (i.e. just imports the content, doesn't set up bi-directional sync between GitHub & GitBook), so the sequence of steps will be:

    1. Publish an SDK package & create a git tag for it
    2. Trigger "gitbook" action on tag creation
    3. In github action: create a new space in gitbook, take its id and trigger import from tag
    4. Go to gitbook and manually write a changelog (we don't have an automated one)
  3. dnechay commented on Sep 3, 2025

    @dnechay
    MemberAuthor

    @portuu3 wdyt on the above suggestion? This way we won't need to have tons of branches and it can be triggered either manually via Postman or we can have a GitHub action for it to create space automatically + trigger sync from git tag

  4. portuu3 commented on Sep 22, 2025

    @portuu3
    Contributor

    @dnechay overall looks good to me. Just I wonder if it can be placed inside SDK.
    Also with UI you cannot choose a tag as ref, we should check if it is possible via API

  5. dnechay commented on Sep 22, 2025

    @dnechay
    MemberAuthor

    @portuu3

    Just I wonder if it can be placed inside SDK

    What exactly you mean? Docs folder? If so, I suppose it should be possible, because you simply provide a path to directory for GitBook, so it can be placed anywhere

    Also with UI you cannot choose a tag as ref, we should check if it is possible via API

    That's true it's not possible via UI, but it's possible via API: I've already done it for 4.3.0 release (you can check that we have docs, but there is no branch), the format is next (POST: https://api.gitbook.com/v1/spaces/space_id/git/import):

    {
        "url": "https://github.com/humanprotocol/human-protocol",
        "ref": "refs/tags/[email protected]",
        "repoProjectDirectory": "./"
    }

    and include api key (generated on UI) in "bearer" auth

  6. portuu3 commented on Sep 22, 2025

    @portuu3
    Contributor

    @dnechay

    What exactly you mean? Docs folder? If so, I suppose it should be possible, because you simply provide a path to directory for GitBook, so it can be placed anywhere

    I mean inside SDK site as new version of the docs and also set the new version as default.

  7. dnechay commented on Sep 22, 2025

    @dnechay
    MemberAuthor

    @portuu3 from what I see in their docs - yes, it's possible to create a new site section via API with new version space assigned to it and then make this new section a default for the site (PATCH call to update site with defaultSiteSpace prop set to new section id). So github action can look like:

    1. Triggered on new sdk@<version> tag creation
    2. Extract <version> from tag
    3. Create new space in GitBook, and keep the id of created space
    4. Import docs from git tag ref to created space
    5. Create new site section from space id, keep its id
    6. Make new section default (home page)
  8. moved this from Backlog to In Progress in Core-tech - 2025on Sep 22, 2025
  9. moved this from In Progress to Backlog in Core-tech - 2025on Sep 22, 2025
  10. moved this from Backlog to Todo in Core-tech - 2025on Sep 22, 2025
  11. moved this from Todo to Backlog in Core-tech - 2025on Sep 22, 2025
  12. portuu3 commented on Sep 23, 2025

    @portuu3
    Contributor

    @portuu3 from what I see in their docs - yes, it's possible to create a new site section via API with new version space assigned to it and then make this new section a default for the site (PATCH call to update site with defaultSiteSpace prop set to new section id). So github action can look like:

    1. Triggered on new sdk@<version> tag creation
    2. Extract <version> from tag
    3. Create new space in GitBook, and keep the id of created space
    4. Import docs from git tag ref to created space
    5. Create new site section from space id, keep its id
    6. Make new section default (home page)

    @dnechay looks good to me then

  13. moved this from Backlog to Todo in Core-tech - 2025on Sep 23, 2025
  14. assigned and unassigned on Oct 3, 2025
  15. moved this from Todo to In Progress in Core-tech - 2025on Oct 3, 2025
  16. moved this from In Progress to In Review in Core-tech - 2025on Oct 7, 2025
  17. moved this from In Review to Done in Core-tech - 2025on Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions