Skip to content

Commit

Permalink
fix: Point docs links to current tag if available (#5219)
Browse files Browse the repository at this point in the history
Instead of pointing to master, load the current tag if it's available on
the environment and use it for redirecting to github.
  • Loading branch information
spalladino authored Mar 14, 2024
1 parent 9298f93 commit 0e9c7c7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 4 additions & 0 deletions docs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
WORKDIR /usr/src/yarn-project
RUN ./bootstrap.sh

# Make COMMIT_TAG visible to build scripts
ARG COMMIT_TAG=""
ENV COMMIT_TAG=$COMMIT_TAG

WORKDIR /usr/src/docs
RUN yarn && yarn build

Expand Down
13 changes: 8 additions & 5 deletions docs/src/preprocess/include_code.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,14 @@ async function preprocessIncludeCode(markdownContent, filePath, rootDir) {
filePath
);

const relativeCodeFilePath = path.resolve(rootDir, codeFilePath);

let urlText = `${relativeCodeFilePath}#L${startLine}-L${endLine}`;
const tag = "master";
const url = `https://github.com/AztecProtocol/aztec-packages/blob/${tag}/${relativeCodeFilePath}#L${startLine}-L${endLine}`;
const relativeCodeFilePath = path
.resolve(rootDir, codeFilePath)
.replace(/^\//, "");
const urlText = `${relativeCodeFilePath}#L${startLine}-L${endLine}`;
const tag = process.env.COMMIT_TAG
? `aztec-packages-${process.env.COMMIT_TAG}`
: "master";
const url = `https://github.com/AztecProtocol/aztec-packages/blob/${tag}/${urlText}`;

const title = noTitle ? "" : `title="${identifier}"`;
const lineNumbers = noLineNumbers ? "" : "showLineNumbers";
Expand Down

0 comments on commit 0e9c7c7

Please sign in to comment.