# Maintainer notes

> Notes for Docsy maintainers

---

LLMS index: [llms.txt](/llms.txt)

---

For our main contributing page covering license agreements, code of conduct and
more, see [Contributing][]. This page is for **maintainers only**.

## Publishing a release

These notes are WIP for creating a **release** from a local copy of the repo.
These instructions assume the release is v0.14.4-dev, if not adjust
accordingly.

1.  **Change directory** to your local Docsy repo.

2.  **Create or update a [changelog][] entry** for v0.14.4-dev.
    - The section should provide a brief summary of breaking changes using the
      section template at the end of the file.
    - Ensure to remove the UNRELEASED note, if still present.
    - You'll create a new section for the next release in a later step.

3.  **Update the release report blog post** for v0.14.4-dev, if any.
    - Remove draft status.
    - Set `date` (or `lastmod` if already published) to today's date.

4.  Run `npm run fix`.

5.  **Update Docsy version** to v0.14.4-dev using the following from a
    (bash or zsh) terminal.
    - First set the `VERSION` variable; we use it throughout the steps below.

      ```sh
      VERSION=v0.14.4-dev
      ```

    - Then run the `set:version` script.

      Docsy is probably already at `v0.14.4-dev-dev`, so you can run:

      ```sh
      npm run set:version
      ```

      Otherwise, set the version explicitly:

      ```sh
      npm run set:version -- --version $VERSION
      ```

      Both forms update the `version` related fields in [package.json][] and
      [docsy.dev/config][] files.

6.  <a id="ci-test-step">Run `npm run ci:test`</a>, which runs `ci:prepare` and
    more to ensure that, e.g., vendor assets and [go.mod] dependencies are
    up-to-date, etc.

7.  **Submit a PR with your changes**.
    - Set the `BASE` variable to the target branch: `main` if this is a stable
      release, and `release` for patch releases.

      ```sh
      BASE=main
      ```

    - Commit any changes accumulated from the previous steps using this title:

      ```text
      Release v0.14.4-dev preparation
      ```

    - Create a PR (with version-checks disabled) using the following command
      that will open a PR-creation page in your browser:

      ```sh
      export SKIP_VERSION_CHECK=1
      gh pr create --web --title "Release $VERSION preparation" \
        --base $BASE \
        --body "- Contributes to #<ADD-RELEASE-PREP-ISSUE-HERE>"
      ```

    - Use the web interface to fill in the PR details.
    - Submit the PR.

8.  **Test the PR** branch from selected sites, and push any required
    adjustments.
    - If the test site uses Docsy as a Git submodule:

      ```sh
      cd themes/docs
      git fetch
      git switch -t REPO/BRANCH-NAME # e.g. chalin/chalin-m24-0.14.0-pre-release
      ```

9.  **Get PR approved and merged**.

10. **Pull the PR** to get the last changes.

11. **Test Docsy** from [docsy-example][], for example.

12. **Ensure** that you're:
    - On the target `$BASE` branch
    - At the commit that you want to tag as v0.14.4-dev

13. **Create the new tag** for v0.14.4-dev.
    - Set the REL variable to the release version or use the `VERSION` variable
      if you set it in the previous step.

      ```sh
      REL=v${VERSION:-v0.14.4-dev}
      echo "REL=$REL"
      ```

    - Create the new tag.

      ```sh
      git tag $REL
      ```

    - Double check:

      ```sh
      git tag --sort=-creatordate | head -3
      ```

14. **Push the new tag**: either to all remotes at once, or one at a time.

    <details>
    <summary class="h6 text-info">Push to all remotes</summary>

    <!-- Prevent Prettier from gluing the list to this HTML hunk -->
    - List the remotes so you know what you'll be pushing to:

      ```sh
      git remote
      ```

    - Check that the `push-all-remotes` alias is defined, and if not, define it:

      ```sh
      git config --global --list | grep alias.push-all-remotes
      ```

      <details>
      <summary class="h6 text-primary">Define a `push-all-remotes` alias</summary>

      First check if the `push-all-remotes` alias is already defined:

      ```sh
      git config --global --list | grep alias.push-all-remotes
      ```

      If not, define the alias:

      ```sh
      git config --global alias.push-all-remotes \
        '!f() { for r in $(git remote); do (set -x; git push "$r" "$1"); done; }; f'
      ```

      > [!NOTE]
      >
      > You only need to define the alias once. Omit `--global` from the command
      > above to make the alias available only in the current repository rather
      > than all repositories.

      </details>

    - If you have git hooks enabled that auto-update the Docsy package version,
      disable the hook check for now:

      ```sh
      export SKIP_VERSION_CHECK=1
      ```

    - Push the tag to the remotes:

      ```console
      $ git push-all-remotes $REL
      + git push origin v0.14.4-dev
      * [new tag]         v0.14.4-dev -> v0.14.4-dev
      + git push upstream v0.14.4-dev
      * [new tag]         v0.14.4-dev -> v0.14.4-dev
      ...
      ```

    - Sanity check over `upstream` for example:

      ```sh
      git ls-remote --tags upstream | grep $REL
      ```

    - Unset the SKIP_VERSION_CHECK variable when you're done:

      ```sh
      unset SKIP_VERSION_CHECK
      ```

    </details>

    <details>
    <summary class="h6">Push to a single remote</summary>

    <!-- Prevent Prettier from gluing the list to this HTML hunk -->
    - Push to a single remote at a time, such as `upstream`:

    ```sh
    git push upstream $REL
    ```

    - Sanity check over `upstream` for example:

      ```sh
      git ls-remote --tags upstream | grep $REL
      ```

    </details>

15. Update the [deploy/prod][] branch from `$BASE`.

    For stable releases from `main`, use:

    ```sh
    git checkout deploy/prod
    git merge --ff-only main
    git push-all-remotes deploy/prod
    ```

    For patch releases from `release`, selectively merge from `$BASE`.

    The branch update will trigger a production deploy of the website.

16. Wait for the production deploy to complete and check that [docsy.dev][] has
    been updated to the new release.

17. **[Draft a new release][]** using GitHub web; fill in the fields as follows:
    - Visit [tags][] to find the new release tag v0.14.4-dev.

    - Select Create a new release from the v0.14.4-dev tag dropdown
      menu

    - **Release title**: use the release version.

      ```text
      v0.14.4-dev
      ```

    - Click **Generate release notes** to get the release details inserted into
      the release notes text area.

    - Add the following text atop the generated release notes:

      ```markdown
      ## Release summary
      
      - [Release 0.14.0 report and upgrade guide][blog]
      - [Changelog v0.14.4-dev][changelog] entry
      
      
      [blog]: <https://www.docsy.dev/blog/2026/0.14.0/>
      [changelog]: <https://www.docsy.dev/project/about/changelog/#0.14.4-dev>

      ```

    - Select **Create a discussion for this release**.

18. **Publish the release**: click _Publish release_.

19. Test the release with a downstream project and/or the [docsy-example][]
    site.

20. If you find issues, determine whether they need to be fixed immediately. If
    so, get fixes submitted, reviewed and approved. Go back to step 1 to publish
    a dot release.

If all is well, release the Docsy example as detailed next.

## Docsy example release

The steps you follow are similar to the ones above for the Docsy release, but
with the following modifications:

1.  **Update the version** of the example to v0.14.4-dev:

    ```sh
    VERSION=v0.14.4-dev
    npm run set:version:example -- --version $VERSION
    ```

2.  Perform [step 6](#ci-test-step) onwards as above to test, create a PR,
    create a release and publish it with one difference:
    - To create a new release draft, visit [Docsy-example release draft][].
    - Once the deploy/prod branch has been updated, wait for the production
      deploy to complete and check that [example.docsy.dev][] has been updated
      to the new release.

[Docsy-example release draft]:
  https://github.com/google/docsy-example/releases/new
[example.docsy.dev]: https://example.docsy.dev

## Post Docsy-release followup

Assuming that both the Docsy and Docsy-example releases v0.14.4-dev
have been successfully deployed, and that at least one other project has been
successfully tested with the new release, then perform the following actions
before any further changes are merged into the `main` branch:

1. Update the package version to a dev ID for Docsy and Docsy-example:

   ```console
   $ npm run -s set:version:git-info
   ✓ Updated package.json version: 0.14.3 → 0.14.3-dev+003-over-main-cf4f514b
   ✓ Updated docsy.dev/config/_default/params.yaml version: 0.14.3 → 0.14.3-dev
   ✓ Updated docsy.dev/config/_default/params.yaml tdBuildId: (none) → 003-over-main-cf4f514b
   ...
   $ npm run -s set:version:example:git-info
   ...
   ```

2. In the [Changelog][]:
   - **Create a new entry** for the next release by copying the ENTRY TEMPLATE
     at the end of the file.

   - **Fix the new release URL**, which ends with `latest?FIXME=...`, so that it
     refers to the actual release, now that it exists.

3. **Submit a PR with your changes**, using a title like:

   ```text
   Set version to v0.14.4-dev
   ```

4. **Get PR approved and merged**.

## Release helper scripts

- NPM scripts: `set:version` and `set:version:*`
- `scripts/get-build-id.sh`: Generates build ID from git describe (empty on
  tags).
- `scripts/set-package-version/index.mjs`: Low-level version manager. See script
  help for usage.

[changelog]: /project/about/changelog/
[contributing]: /docs/contributing/
[deploy/prod]: <https://github.com/google/docsy/tree/deploy/prod>
[docsy-example]: <https://github.com/google/docsy-example>
[docsy.dev]: <https://deploy-preview-2606--docsydocs.netlify.app/>
[docsy.dev/config]: <https://github.com/google/docsy/blob/main/docsy.dev/config/>
[Draft a new release]: <https://github.com/google/docsy/releases/new>
[go.mod]: <https://github.com/google/docsy/blob/main/go.mod>
[package.json]: <https://github.com/google/docsy/blob/main/package.json>
[tags]: <https://github.com/google/docsy/tags>
