-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: build docs in earthly (#6038)
Adds a `docs-preview` job to the github actions `CI` workflow which: 1. Builds the docs 2. Adds the familiar PR comment with link to preview Adds a `Publish Docs` workflow, which gets triggered from the `release-please` workflow which builds and deploys docs to production. Removes doc builds from circle ci.
- Loading branch information
1 parent
1a89d1a
commit 784d542
Showing
20 changed files
with
6,508 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Publish Docs | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: The tag to build from (leave empty to build a nightly release from master) | ||
required: true | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.tag || env.GITHUB_REF }} | ||
|
||
- timeout-minutes: 25 | ||
run: earthly --no-output ./docs/+deploy-prod --NETLIFY_AUTH_TOKEN=${{ secrets.NETLIFY_AUTH_TOKEN }} --NETLIFY_SITE_ID=${{ secrets.NETLIFY_SITE_ID }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.docusaurus | ||
node_modules | ||
processed-docs | ||
processed-docs-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
VERSION 0.8 | ||
|
||
FROM node:18.19.0 | ||
WORKDIR /usr/src/docs | ||
|
||
deps: | ||
RUN apt update && apt install -y jq curl perl && rm -rf /var/lib/apt/lists/* && apt-get clean | ||
COPY ./yarn.lock ./yarn.lock | ||
COPY ./package.json ./package.json | ||
RUN yarn install --frozen-lockfile | ||
|
||
build: | ||
BUILD ../yarn-project/+build-dev | ||
BUILD ../+release-meta | ||
FROM +deps | ||
|
||
COPY --dir ../yarn-project/+build-dev/usr/src /usr | ||
COPY ../+release-meta/usr/src/.release-please-manifest.json /usr/src | ||
|
||
COPY . . | ||
|
||
RUN ./scripts/build.sh | ||
SAVE ARTIFACT build | ||
|
||
serve: | ||
FROM +deps | ||
COPY +build/build build | ||
COPY ./static static | ||
COPY ./src src | ||
COPY ./docusaurus.config.js . | ||
COPY ./sidebars.js . | ||
ENTRYPOINT ["yarn", "serve"] | ||
EXPOSE 3000 | ||
SAVE ARTIFACT /usr/src/docs | ||
SAVE IMAGE aztecprotocol/docs-server | ||
|
||
deploy-preview: | ||
BUILD ../yarn-project/+scripts-prod | ||
ARG NETLIFY_AUTH_TOKEN | ||
ARG NETLIFY_SITE_ID | ||
ARG AZTEC_BOT_COMMENTER_GITHUB_TOKEN | ||
ARG PR | ||
FROM +serve | ||
COPY --dir ../yarn-project/+scripts-prod/usr/src/yarn-project /usr/src | ||
COPY ./netlify.toml . | ||
COPY ./deploy_preview.sh . | ||
RUN NETLIFY_AUTH_TOKEN=$NETLIFY_AUTH_TOKEN NETLIFY_SITE_ID=$NETLIFY_SITE_ID ./deploy_preview.sh $PR $AZTEC_BOT_COMMENTER_GITHUB_TOKEN | ||
|
||
deploy-prod: | ||
BUILD ../yarn-project/+scripts-prod | ||
ARG NETLIFY_AUTH_TOKEN | ||
ARG NETLIFY_SITE_ID | ||
FROM +serve | ||
COPY ./netlify.toml . | ||
COPY ./deploy_prod.sh . | ||
RUN NETLIFY_AUTH_TOKEN=$NETLIFY_AUTH_TOKEN NETLIFY_SITE_ID=$NETLIFY_SITE_ID ./deploy_prod.sh |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bash | ||
set -eu | ||
|
||
PR_NUMBER=$1 | ||
AZTEC_BOT_COMMENTER_GITHUB_TOKEN="$2" | ||
|
||
API_URL="https://api.github.com/repos/AztecProtocol/aztec-packages/pulls/${PR_NUMBER}/files" | ||
|
||
echo "API URL: $API_URL" | ||
|
||
DOCS_CHANGED=$(curl -L \ | ||
-H "Authorization: Bearer $AZTEC_BOT_COMMENTER_GITHUB_TOKEN" \ | ||
"${API_URL}" | \ | ||
jq '[.[] | select(.filename | startswith("docs/"))] | length > 0') | ||
|
||
echo "Docs changed: $DOCS_CHANGED" | ||
|
||
if [ "$DOCS_CHANGED" = "false" ]; then | ||
echo "No docs changed, not deploying" | ||
exit 0 | ||
fi | ||
|
||
# Regular deploy if the argument is not "master" and docs changed | ||
DEPLOY_OUTPUT=$(yarn netlify deploy --site aztec-docs-dev) | ||
DOCS_PREVIEW_URL=$(echo "$DEPLOY_OUTPUT" | grep -E "https://.*aztec-docs-dev.netlify.app" | awk '{print $4}') | ||
echo "Unique deploy URL: $DOCS_PREVIEW_URL" | ||
|
||
cd ../yarn-project/scripts | ||
AZTEC_BOT_COMMENTER_GITHUB_TOKEN=$AZTEC_BOT_COMMENTER_GITHUB_TOKEN PR_NUMBER=$PR_NUMBER DOCS_PREVIEW_URL=$DOCS_PREVIEW_URL yarn docs-preview-comment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env bash | ||
set -eu | ||
|
||
netlify deploy --site aztec-docs-dev --prod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.