Skip to content

Commit e04afaa

Browse files
authored
Merge pull request #231 from KomodoPlatform/dev
2 parents 9111255 + 9ef39b1 commit e04afaa

File tree

911 files changed

+68541
-269006
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

911 files changed

+68541
-269006
lines changed

.github/workflows/get_data_lint_files_deploy.yml

+88-79
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ jobs:
5151
run: cd utils/js && npm ci
5252

5353
- name: Get file and Author data
54+
if: github.base_ref == 'main' || github.ref == 'refs/heads/main'
5455
run: node utils/js/get_file_author_data.js
5556

5657
- name: Validate and Update links
@@ -60,7 +61,7 @@ jobs:
6061
run: node utils/js/file_presence_structure_checker.js
6162

6263
- name: Verify h1 is present in every file
63-
run: node utils/js/h1_presence_checker.js
64+
run: node utils/js/h1_presence_format_checker.js
6465

6566
- name: Prepare data files for GPTs
6667
if: github.base_ref == 'main' || github.ref == 'refs/heads/main'
@@ -70,7 +71,11 @@ jobs:
7071
if: github.base_ref == 'main' || github.ref == 'refs/heads/main'
7172
run: node utils/js/ensure_changelog_update.js
7273

73-
- name: Set lint-fix branch name
74+
- name: Generate Search Index
75+
if: github.base_ref == 'main' || github.ref == 'refs/heads/main'
76+
run: node utils/js/create_search_index.js
77+
78+
- name: Set branch name, commit_sha, lint-fix branch name
7479
id: vars
7580
shell: bash
7681
run: |
@@ -79,86 +84,25 @@ jobs:
7984
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT
8085
lint_branch_name="lint-fix-patches/${BRANCH_NAME}"
8186
echo "lint_branch_name=$lint_branch_name" >> $GITHUB_OUTPUT
82-
83-
- name: Check if diff exists
84-
id: diff_check
85-
run: |
86-
if git diff --quiet; then
87-
echo "NO_DIFF=true" >> $GITHUB_OUTPUT
88-
else
89-
echo "NO_DIFF=false" >> $GITHUB_OUTPUT
90-
fi
91-
92-
- name: Create Pull Request
93-
uses: peter-evans/create-pull-request@v5
94-
with:
95-
token: ${{ secrets.GITHUB_TOKEN }}
96-
commit-message: "[Bot] File and author data updated, validated and updated internal links, formatted md content, checked presence of file and dirs based on sidebar, checked presence of h1 in every file, update atomicdex methods table"
97-
committer: GitHub <[email protected]>
98-
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
99-
branch: ${{ steps.vars.outputs.lint_branch_name}}
100-
delete-branch: true
101-
title: "[BOT] PR to ${{ steps.vars.outputs.branch_name}}. Lints file structure, file contents, gets author data, Updates AtomicDEX API Methods Table"
102-
body: |
103-
- File and author data updated, validated and updated internal links, formatted md content, checked presence of file and dirs based on sidebar, checked presence of h1 in every file, AtomicDEX API Methods Table auto-generated
104-
labels: |
105-
autogenerated
106-
reviewers: smk762, gcharang
107-
draft: false
108-
outputs:
109-
NO_DIFF: ${{ steps.diff_check.outputs.NO_DIFF}}
110-
LINT_BRANCH: ${{ steps.vars.outputs.lint_branch_name}}
111-
BRANCH: ${{ steps.vars.outputs.BRANCH_NAME}}
112-
113-
web_build_and_preview:
114-
needs: update_lint_get_data
115-
name: Build and deploy
116-
runs-on: ubuntu-latest
117-
timeout-minutes: 45
118-
steps:
119-
- name: Extract branch name of mdx repo
120-
shell: bash
121-
run: |
122-
BRANCH_NAME="${{ github.head_ref || github.ref }}"
123-
BRANCH_NAME=${BRANCH_NAME#refs/heads/} # remove the refs/heads/ prefix
124-
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_OUTPUT
125-
id: get_branch
126-
127-
- name: Shortify commit sha
128-
shell: bash
129-
run: |
13087
echo "sha_short=$(echo ${GITHUB_SHA::7})" >> $GITHUB_OUTPUT
131-
id: shortify_commit
13288
13389
- name: Checkout code
13490
uses: actions/checkout@v3
13591
with:
92+
path: website-komodo-docs
13693
ssh-key: ${{ secrets.DOCS_UI_SSH_PRIVATE_KEY }}
13794
repository: KomodoPlatform/website-komodo-docs
138-
ref: main
95+
ref: dev
13996
submodules: recursive
14097
fetch-depth: 0
14198

142-
- name: Get updated content (without diff)
143-
if: needs.update_lint_get_data.outputs.NO_DIFF == 'true'
144-
run: |
145-
cd utils
146-
./update_mdx_branch.sh ${{ needs.update_lint_get_data.outputs.BRANCH }}
147-
cd ..
148-
./update-content.sh
149-
150-
- name: Get updated content (with diff)
151-
if: needs.update_lint_get_data.outputs.NO_DIFF == 'false'
152-
run: |
153-
cd utils
154-
./update_mdx_branch.sh ${{ needs.update_lint_get_data.outputs.LINT_BRANCH }}
155-
cd ..
156-
./update-content.sh
157-
15899
- uses: actions/setup-node@v3
100+
env:
101+
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true"
159102
with:
160-
node-version: "16.14"
103+
node-version: "18.9.0"
161104
cache: yarn
105+
cache-dependency-path: "**/yarn.lock"
162106

163107
- name: Restore cache
164108
uses: actions/cache@v3
@@ -171,14 +115,20 @@ jobs:
171115
# If source files changed but packages didn't, rebuild from a prior cache.
172116
restore-keys: nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
173117

174-
- name: Install build deps
175-
run: yarn install
176-
177-
- name: Build
178-
run: yarn export:cfp
179-
180-
- name: Add no-index headers before pubishing to cloudflare
118+
- name: Get updated content, Install deps, build, Add no-index headers before pubishing to cloudflare
181119
run: |
120+
pwd
121+
echo $GITHUB_WORKSPACE
122+
ls $GITHUB_WORKSPACE
123+
cd $GITHUB_WORKSPACE/website-komodo-docs/utils
124+
./update_mdx_branch.sh ${{ steps.vars.outputs.BRANCH_NAME }}
125+
cd ..
126+
export CFP=yes
127+
./update-content.sh
128+
rsync -avh --delete $GITHUB_WORKSPACE/utils/_fileData.json $GITHUB_WORKSPACE/website-komodo-docs/_fileData.json
129+
rsync -avh --delete $GITHUB_WORKSPACE/utils/_searchIndex.json $GITHUB_WORKSPACE/website-komodo-docs/lib/data/searchIndex.json
130+
yarn install
131+
yarn export
182132
echo -e "https://:project.pages.dev/*\n X-Robots-Tag: noindex" > ./out/_headers
183133
184134
- name: Publish to Cloudflare Pages
@@ -188,10 +138,10 @@ jobs:
188138
apiToken: ${{ secrets.CF_API_TOKEN }}
189139
accountId: ${{ secrets.CF_ACCOUNT_ID }}
190140
projectName: komodo-docs
191-
directory: ./out
141+
directory: ./website-komodo-docs/out
192142
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
193143
wranglerVersion: "3"
194-
branch: ${{ steps.get_branch.outputs.BRANCH_NAME }}
144+
branch: ${{ steps.vars.outputs.BRANCH_NAME }}
195145

196146
- name: Post CF preview url
197147
uses: actions/github-script@v6
@@ -202,5 +152,64 @@ jobs:
202152
issue_number: context.issue.number,
203153
owner: context.repo.owner,
204154
repo: context.repo.repo,
205-
body: "Preview for merge commit: ${{ steps.shortify_commit.outputs.sha_short }}, available on cloudflare at: ${{ steps.cf_publish.outputs.url }}/en/docs/"
155+
body: "Preview for merge commit: ${{ steps.vars.outputs.sha_short }}, available on cloudflare at: ${{ steps.cf_publish.outputs.url }}/en/docs/"
206156
})
157+
158+
- name: Update package repos, Install libgconf-2-4, wget, Add Google Chrome repository, Install Google Chrome Stable, Clean up
159+
if: github.base_ref == 'main' || github.ref == 'refs/heads/main'
160+
run: |
161+
sudo apt-get update
162+
sudo apt-get install -yq libgconf-2-4
163+
sudo apt-get install -y wget --no-install-recommends
164+
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
165+
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google.list
166+
sudo apt-get update
167+
sudo apt-get install -y google-chrome-stable --no-install-recommends
168+
sudo rm -rf /var/lib/apt/lists/*
169+
170+
# Setting environment variable for Puppeteer and generating preview images
171+
- name: Set PUPPETEER_SKIP_CHROMIUM_DOWNLOAD and CF_PUBLISH_URL
172+
if: github.base_ref == 'main' || github.ref == 'refs/heads/main'
173+
run: |
174+
echo "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true" >> $GITHUB_ENV
175+
echo "CF_PUBLISH_URL=${{ steps.cf_publish.outputs.url }}" >> $GITHUB_ENV
176+
177+
- name: Generate Preview Images
178+
if: github.base_ref == 'main' || github.ref == 'refs/heads/main'
179+
run: |
180+
cd $GITHUB_WORKSPACE/website-komodo-docs/
181+
git status
182+
yarn gen:previewImgs
183+
184+
- name: Update mdx repo with preview images
185+
if: github.base_ref == 'main' || github.ref == 'refs/heads/main'
186+
run: mkdir -p $GITHUB_WORKSPACE/preview-images/optimized/ && mkdir -p $GITHUB_WORKSPACE/preview-images/original/ && rsync -avh --delete $GITHUB_WORKSPACE/website-komodo-docs/preview-images-original/ $GITHUB_WORKSPACE/preview-images/original/ && rsync -avh --delete $GITHUB_WORKSPACE/website-komodo-docs/public/preview-images/ $GITHUB_WORKSPACE/preview-images/optimized/ && rsync -avh --delete $GITHUB_WORKSPACE/website-komodo-docs/previewImgTimeStamps.json $GITHUB_WORKSPACE/preview-images/previewImgTimeStamps.json
187+
188+
- name: Delete repo checked out UI repo
189+
run: rm -rf $GITHUB_WORKSPACE/website-komodo-docs
190+
191+
# - name: Check if diff exists
192+
# id: diff_check
193+
# run: |
194+
# if git diff --quiet; then
195+
# echo "NO_DIFF=true" >> $GITHUB_OUTPUT
196+
# else
197+
# echo "NO_DIFF=false" >> $GITHUB_OUTPUT
198+
# fi
199+
200+
- name: Create Pull Request
201+
uses: peter-evans/create-pull-request@v6
202+
with:
203+
token: ${{ secrets.GITHUB_TOKEN }}
204+
commit-message: "[Bot] File and author data updated, validated and updated internal links, formatted md content, checked presence of file and dirs based on sidebar, checked presence of h1 in every file, update Komodo DeFi Framework methods table, adds/updates preview images when base is main"
205+
committer: GitHub <[email protected]>
206+
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
207+
branch: ${{ steps.vars.outputs.lint_branch_name}}
208+
delete-branch: true
209+
title: "[BOT] PR to ${{ steps.vars.outputs.branch_name}}. Lints file structure, file contents, gets author data, Updates Komodo DeFi Framework Methods Table, adds/updates preview images"
210+
body: |
211+
- File and author data updated, validated and updated internal links, formatted md content, checked presence of file and dirs based on sidebar, checked presence of h1 in every file, Komodo DeFi Framework Methods Table auto-generated
212+
labels: |
213+
autogenerated
214+
reviewers: smk762, gcharang
215+
draft: false

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ Thumbs.db
3434
*.pid
3535
*.sublime-*
3636

37-
#custom
37+
# custom
38+
filepathSlugs.json
3839
links-to-manually-check

0 commit comments

Comments
 (0)