Skip to content

Commit

Permalink
feat: update and build chain data from chainlist.org via git submodul…
Browse files Browse the repository at this point in the history
…e, enable explorer in frame via config per chain
  • Loading branch information
xtools-at committed Oct 25, 2023
1 parent 345e913 commit 1774363
Show file tree
Hide file tree
Showing 78 changed files with 10,915 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .ci/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh -
. $(dirname "$0")/env.sh

yarn install --prefer-offline --pure-lockfile --cache-folder .yarn --modules-folder node_modules

echo "[BUILD] Clean built files ($BUILD_DIR)"
rm -rf $BUILD_DIR
echo "[BUILD] Cleaned"

echo "[BUILD] Building"
yarn build
echo "[BUILD] Built"

echo "[BUILD] Copy runtime files"
mv out $BUILD_DIR
echo "[BUILD] Copied"
8 changes: 8 additions & 0 deletions .ci/ci-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh -
. $(dirname "$0")/env.sh

echo "[CI-RELEASE] Preparing files.."
rm -rf $BUILD_DIR/.gitlab-ci.yml
mv public public-org
mv $BUILD_DIR public
echo "[CI-RELEASE] Done"
12 changes: 12 additions & 0 deletions .ci/env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh -

echo "[ENV] Set build dir"
export BUILD_DIR=.build

echo "[ENV] Set release dir"
export RELEASE_DIR=.release

echo "[ENV] Set git data"
export GIT_BRANCH=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD)
export GIT_BUILD_BRANCH=$GIT_BRANCH-build
export GIT_COMMIT=$(git rev-parse --short HEAD)
28 changes: 28 additions & 0 deletions .ci/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh -
. $(dirname "$0")/env.sh

echo "[RELEASE] Clean released files ($RELEASE_DIR)"
rm -rf $RELEASE_DIR
echo "[RELEASE] Cleaned"

echo "[RELEASE] Pushing current working tree.."
(git add -A ; git commit -m "Manual build" ; git push origin $GIT_BRANCH) || (echo "Working tree clean")
echo "[RELEASE] Pushed ($GIT_BRANCH/$GIT_COMMIT).."

. $(dirname "$0")/build.sh

echo "[RELEASE] Syncing build files from $GIT_BUILD_BRANCH.."
rm -rf $RELEASE_DIR
mkdir $RELEASE_DIR
mv .git $RELEASE_DIR/.git
cd $RELEASE_DIR ; git branch -D $GIT_BUILD_BRANCH ; (git checkout $GIT_BUILD_BRANCH) || (git checkout -b $GIT_BUILD_BRANCH) ; git stash && git stash drop; (git pull --depth 1 origin $GIT_BUILD_BRANCH --rebase --allow-unrelated-histories) || (echo "Build files synced") ; cd ..
echo "[RELEASE] Synced"

echo "[RELEASE] Pushing build files.."
mv $RELEASE_DIR/.git . ; rm -rf $RELEASE_DIR ; cp -r $BUILD_DIR $RELEASE_DIR ; mv .git $RELEASE_DIR/.git
cd $RELEASE_DIR ; touch .nojekyll ; git add -A ; git commit -m "Manual build $GIT_COMMIT" ; git push origin $GIT_BUILD_BRANCH ; git checkout $GIT_BRANCH ; git branch -D $GIT_BUILD_BRANCH ; cd ..
echo "[RELEASE] Pushed"

echo "[RELEASE] Switch back to $GIT_BRANCH.."
mv $RELEASE_DIR/.git .
echo "[RELEASE] Switched"
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
root = true

[*]
end_of_line = lf
insert_final_newline = false


indent_style = tab
indent_size = 2

[*.{js,php,html,css,py,twig,less,scss,jsx,ts,tsx}]
charset = utf-8

59 changes: 59 additions & 0 deletions .github/workflows/deploy-to-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Deploy to Pages

env:
ASSET_PREFIX: "/"

on:
push:
branches: [main]
paths-ignore:
- ".gitlab-ci.yml"
- ".gitlab-ci-disabled.yml"
- "README.md"
- "COPYING"
- "docs/**"

jobs:
build-push:
name: "Build & Push"
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [lts/*]

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: "npm"

- name: Install yarn
run: npm install -g yarn

- name: Cache deps
uses: actions/cache@v2
with:
path: |
./node_modules
./.yarn
./.next/cache
key: ${{ runner.os }}-modules-${{ hashFiles('./yarn.lock') }}

- name: Build & Push
run: |
git config --global user.name $GITHUB_ACTOR
git config --global user.email $GITHUB_ACTOR@users.noreply.github.com
export NEXT_TELEMETRY_DISABLED=1
./.ci/release.sh
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: build
path: ./.build
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
/node_modules
/.yarn

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Next.js
/.next
/out
37 changes: 37 additions & 0 deletions .gitlab-ci-disabled.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
stages:
- build
- pages

build:
stage: build
image: node:lts
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- ./node_modules
- ./.yarn
- ./.next/cache
artifacts:
paths:
- .build/
expire_in: 1 day
script:
- export NEXT_TELEMETRY_DISABLED=1
- ./.ci/build.sh

pages:
stage: pages
image:
name: alpine:latest
entrypoint: [""]
cache: {}
artifacts:
paths:
- public

script:
- ./.ci/ci-release.sh
- ls -la public

only:
- main
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "config/chainlist"]
path = config/chainlist
url = https://github.com/ethereum-lists/chains.git
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"esbenp.prettier-vscode",
"streetsidesoftware.code-spell-checker"
]
}
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.tabSize": 2,
"json.format.enable": true
}
Loading

0 comments on commit 1774363

Please sign in to comment.