Skip to content

Commit

Permalink
Merge branch 'main' into ph/inactive-vals-v50-2
Browse files Browse the repository at this point in the history
  • Loading branch information
p-offtermatt committed Jul 24, 2024
2 parents 5ceaffc + f8662ac commit a859f7a
Show file tree
Hide file tree
Showing 26 changed files with 788 additions and 520 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ jobs:
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0
uses: docker/setup-buildx-action@aa33708b10e362ff993539393ff100fa93ed6a27 # v3.5.0


# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
Expand All @@ -80,7 +80,7 @@ jobs:
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@a254f8ca60a858f3136a2f1f23a60969f2c402dd #v6.4.0
uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445 #v6.5.0
with:
context: .
file: ./Dockerfile
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ build/
.idea

# docusaurus versioned docs created during build
docs/versions.json
docs/versioned_docs
docs/versioned_sidebars
56 changes: 1 addition & 55 deletions RELEASE_PROCESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,9 @@ Once the **final release** is cut, the new changelog section must be added to ma

## Updating published docs

### Before tagging a new release

On your release branch, clear the `docs/versions.json` file so it looks like this:
```json
[]
```

If this file is populated on a release branch it will cause the tag to have extra files that the docs deploy process does not expect. This could cause the deploy process to fail in some situations.

### After tagging a new release

Go to `main` branch and update the `docs/versions.json` to include all the versions you want to publish on the docs page:
Go to `main` branch and update the `docs/supported_versions.json` to include all the versions you want to publish on the docs page:
```json
[
"v4.3.0",
Expand All @@ -130,51 +121,6 @@ Go to `main` branch and update the `docs/versions.json` to include all the versi

This will cause the docs to be built with `main`, `v4.3.0` and `v5.0.0`.

In `docs/docusaurus.config.js` change the `preset` section to display the versions you chose in `docs/versions.json`.

For example, here we remove v4.2.0 and replace it with v4.3.0.

```diff
presets: [
[
"classic",
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve("./sidebars.js"),
routeBasePath: "/",
versions: {
current: {
path: "/",
label: "main",
banner: "unreleased",
},
// v4.2.0-docs was a special tags for docs
// this is not usually necessary
- "v4.2.0-docs": {
- path: "/v4.2.0/",
- label: "v4.2.0",
- banner: "none",
- },
+ "v4.3.0": {
+ banner: "none",
+ },
"v5.0.0": {
banner: "unreleased",
},
},
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex],
},
theme: {
customCss: require.resolve("./src/css/custom.css"),
},
}),
],
],
```
The documentation is updated automatically whenever `main` is changed.

To learn how to work with docs locally check the docs [README.md on main branch](https://github.com/cosmos/interchain-security/blob/main/docs/README.md)
Expand Down
24 changes: 24 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ $ npm run build

This command generates static content into the `build` directory and can be served using any static contents hosting service.

This is not intended for local development but it is used during the deploy sequence.

# Adding versions

Expand Down Expand Up @@ -53,9 +54,12 @@ The script above will create `versioned_docs` and `versioned_sidebars` directori
To view the docs run:

```shell
cp supported_versions.json versions.json # needed to show the version dropdown
npm run start
```

Remove `versions.json` after use to prevent interference with local documentation.

Remember to check back out to your working branch. Running `./sync_versions.sh` will leave you in a detached head state.
(simply run `git checkout <working-branch>)

Expand All @@ -71,3 +75,23 @@ The script switches branches while building the versioned docs - **please note t
The `./docs/legacy` directory on `legacy-docs-page` was created manually, by modifying `docusaurus.config.js` and `versions.json` on `https://github.com/cosmos/interchain-security/releases/v3.3.1-lsm` and generating the static pages manually using `npm run build`.

The `./docs/legacy` directory gets included into the rest of the documentation using a simple `cp` command during the deploy process using the [build_deploy.sh](./build_deploy.sh) script. It is **not** included during local builds.


# Scripts and make commands

`build_deploy.sh` script builds the documentation output directory for serving static HTML files. It should be executed on the remote server.

`build_local.sh` will build the documentation locally by running `npm run build`. You can check the built web page by running `npm run serve` after the build command completes.

`sync_versions.sh` will fetch and build all docs versions specified in `supported_versions.json`. It is intended to be executed on the remote server.

`versions.json` must remain empty or be removed from your worktree. Avoid pushing it to GitHub.
* this file specifies which versions will be displayed in the supported versions drop down on the docs page
* instead of using it, the supported versions should live in `supported_versions.json`
* this file should only be populated during deployment and never on your local machine

# Building on remote

Building on remote host is handled by [deploy-docs.yml workflow](.github/workflows/deploy-docs.yml).

It executes `./sync_versions.sh` and `./build_deploy.sh` scripts and allows the output of the build proces to be served by github pages.
1 change: 1 addition & 0 deletions docs/build_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# build versioned docs prepared by sync_versions.sh
echo "building docusaurus main docs"
cp supported_versions.json versions.json
npm ci && npm run build

# copy "legacy" docs directory into the final build directory
Expand Down
15 changes: 0 additions & 15 deletions docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,6 @@ const config = {
docs: {
sidebarPath: require.resolve("./sidebars.js"),
routeBasePath: "/",
versions: {
current: {
path: "/",
label: "main",
banner: "unreleased",
},
"v4.2.0-docs": {
path: "/v4.2.0/",
label: "v4.2.0",
banner: "none",
},
"v5.0.0": {
banner: "unreleased",
},
},
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex],
exclude: ["**/templates/*"],
Expand Down
4 changes: 4 additions & 0 deletions docs/supported_versions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[
"v5.1.0",
"v4.4.1"
]
2 changes: 1 addition & 1 deletion docs/sync_versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
if git diff-index --quiet HEAD --; then
# initial branch
COMMIT=$(git rev-parse HEAD)
for version in $(jq -r .[] versions.json); do
for version in $(jq -r .[] supported_versions.json); do
echo "Building docusaurus $version docs ..."
git checkout $version
npm cache clean --force && npm install && npm run docusaurus docs:version $version
Expand Down
4 changes: 0 additions & 4 deletions docs/versions.json

This file was deleted.

24 changes: 11 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,19 @@ require (
github.com/spf13/cobra v1.8.0
github.com/stretchr/testify v1.9.0
github.com/tidwall/gjson v1.17.1
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0
golang.org/x/net v0.24.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sys v0.20.0 // indirect
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/grpc v1.63.2
google.golang.org/protobuf v1.33.0
google.golang.org/grpc v1.65.0
google.golang.org/protobuf v1.34.1
gopkg.in/yaml.v2 v2.4.0
)

require (
cloud.google.com/go v0.112.0 // indirect
cloud.google.com/go/compute v1.24.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/compute/metadata v0.3.0 // indirect
cloud.google.com/go/iam v1.1.6 // indirect
cloud.google.com/go/storage v1.36.0 // indirect
cosmossdk.io/api v0.7.5
Expand Down Expand Up @@ -134,9 +133,9 @@ require (
github.com/zondax/ledger-go v0.14.3 // indirect
go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/term v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/oauth2 v0.20.0 // indirect
golang.org/x/term v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
google.golang.org/api v0.171.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand All @@ -161,7 +160,7 @@ require (
github.com/informalsystems/itf-go v0.0.1
github.com/spf13/viper v1.18.2
golang.org/x/mod v0.17.0
google.golang.org/genproto/googleapis/api v0.0.0-20240311132316-a219d84964c2
google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157
)

require (
Expand Down Expand Up @@ -209,8 +208,7 @@ require (
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect
gotest.tools/v3 v3.5.1 // indirect
)

Expand Down
Loading

0 comments on commit a859f7a

Please sign in to comment.