Skip to content

Commit

Permalink
Merge branch 'main' into fb/chain-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
FrederikBolding authored Jul 25, 2024
2 parents 43b670a + 96897c2 commit d2d7dda
Show file tree
Hide file tree
Showing 9 changed files with 211 additions and 54 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/auto-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,27 @@ name: Auto Deploy

on:
schedule:
- cron: '0 0 * * *'
- cron: "0 0 * * *"

jobs:
check:
runs-on: ubuntu-latest
outputs:
deploy: ${{ steps.set-output.outputs.deploy }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check if deployment is needed
id: set-output
shell: bash
env:
BUILD_HOOK: ${{ secrets.NETLIFY_BUILD_HOOK }}
run: ./scripts/check-deploy.sh

deploy:
needs: check
if: needs.check.outputs.deploy == 'true'
name: Publish to the `gh-pages` branch
permissions:
contents: write
uses: ./.github/workflows/publish.yml
with:
destination_dir: ./
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build

on:
workflow_call:

jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install Yarn dependencies
run: yarn --immutable

build:
name: Build
runs-on: ubuntu-latest
needs:
- prepare
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- run: yarn --immutable --immutable-cache
- run: yarn build
- name: Require clean working directory
shell: bash
run: |
if ! git diff --exit-code; then
echo "Working tree dirty at end of job"
exit 1
fi
34 changes: 34 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Main

on:
push:
branches: [main]
pull_request:

jobs:
check-workflows:
name: Check workflows
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download actionlint
id: download-actionlint
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/7fdc9630cc360ea1a469eed64ac6d78caeda1234/scripts/download-actionlint.bash) 1.6.23
shell: bash
- name: Check workflow files
run: ${{ steps.download-actionlint.outputs.executable }} -color
shell: bash

build:
name: Build
uses: ./.github/workflows/build.yml

publish-to-gh-pages:
needs: build
if: github.ref == 'refs/heads/main'
name: Publish to the `gh-pages` branch
permissions:
contents: write
uses: ./.github/workflows/publish.yml
with:
destination_dir: ./
33 changes: 33 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish to GitHub Pages

on:
workflow_call:
inputs:
destination_dir:
required: true
type: string

jobs:
publish:
name: Publish to GitHub Pages
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Ensure `destination_dir` is not empty
if: ${{ inputs.destination_dir == '' }}
run: exit 1
- uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- run: yarn --immutable
- name: Run build script
run: yarn build
- name: Deploy to `${{ inputs.destination_dir }}` directory of `gh-pages` branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
destination_dir: ${{ inputs.destination_dir }}
5 changes: 2 additions & 3 deletions scripts/check-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ shouldDeploy=$(curl -s https://api.github.com/repos/ethereum-lists/chains/commit

if [ $shouldDeploy -eq 0 ]
then
echo "Deploying..."
curl -X POST -d '{}' https://api.netlify.com/build_hooks/${BUILD_HOOK}
echo "deploy=true" >> "$GITHUB_OUTPUT"
else
echo "No deploy needed"
echo "deploy=false" >> "$GITHUB_OUTPUT"
fi
2 changes: 1 addition & 1 deletion src/components/ChainList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const ChainList = () => {
const filteredChains = chains.filter(handleFiltering);

return (
<SimpleGrid minChildWidth="300px" spacing={4}>
<SimpleGrid minChildWidth="300px" spacing={4} mb="8">
{filteredChains.map((c) => (
<Chain key={c.id} {...c} />
))}
Expand Down
2 changes: 1 addition & 1 deletion src/context/SearchContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const SearchProvider = ({ children }) => {

const [query, setQuery] = useState("");
const [showTestnets, setShowTestnets] = useState(
defaults?.showTestnets ?? false
defaults?.showTestnets ?? true
);
const [showDeprecated, setShowDeprecated] = useState(
defaults?.showDeprecated ?? false
Expand Down
1 change: 1 addition & 0 deletions static/CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
chainlist.wtf
Loading

0 comments on commit d2d7dda

Please sign in to comment.