Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(docs): Show latest released code on published site (AztecProtocol…
…#3716) Our docs build script checks a `INCLUDE_RELEASED_CODE` env var to determine what code snippets to include in the site build (either latest released version or master). This should be set when deploying the site to the public, which happens on every build on master. So we need to set this env var when on master. However, just setting the env var doesn't work, since we need to get it inside the docs docker build context. Also, we need this build to be seen as different than a build in a branch by the `check_rebuild` script, even if they have the same content hash, since `INCLUDE_RELEASED_CODE` affects the result. One option for fixing this would've been adding a mechanism for passing args to the `build` script in `build-system` which in turn passes them as `ARG`s to the `docker build` call, so they can be turned into `ENV` vars visible by our scripts. Another option could've been defining a different `Dockerfile`, a `Dockerfile.master`, where this `ENV` var is hardcoded. However, neither of these solves the `check_rebuild` issue. So what we're doing is manually changing the contents of the `docs` folder by writing a `.env` file with the env var we need to set, and loading it when building. This both gets the env var inside the docker context (since we're passing it in a file) and triggers a rebuild when needed (since it changes the inputs used for calculating the content hash). Separately from the issues above, we need to manually fetch additional commits from the repo, since we need to load code from the released commit. We're doing that in the same step where we set up the `.env`, which is after the checkout but before the build step. While this approach seems to work, it is doing much stuff around build-system, rather than playing along with it. So @charlielye I'd appreciate your comments here before merging!
- Loading branch information