Skip to content

Commit 488240d

Browse files
committed
first commit [no ci]
1 parent df0cdee commit 488240d

File tree

110 files changed

+4919
-1
lines changed

Some content is hidden

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

110 files changed

+4919
-1
lines changed

.env.example

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# [optional] to query network subgraph for validation
2+
THEGRAPH_STUDIO_KEY=<YOUR_STUDIO_KEY>

.github/workflows/format.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
on:
2+
# pull_request:
3+
# types: [opened, synchronize, reopened]
4+
workflow_dispatch:
5+
6+
name: Format on PR
7+
8+
jobs:
9+
format-files:
10+
name: Check JSON formatting
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Repository
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Bun
17+
uses: oven-sh/setup-bun@v1
18+
with:
19+
bun-version: latest
20+
21+
- name: Install dependencies
22+
run: bun install --no-save
23+
24+
- name: Check formatting
25+
run: bun format:check

.github/workflows/publish.yml

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
workflow_dispatch:
6+
7+
name: Validate, generate and publish registry
8+
9+
jobs:
10+
upload-registry:
11+
name: Upload to Cloudflare Pages
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: 'write'
15+
steps:
16+
- name: Checkout Repository
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
ssh-key: ${{ secrets.DEPLOY_KEY }}
21+
22+
- name: Setup Bun
23+
uses: oven-sh/setup-bun@v1
24+
with:
25+
bun-version: latest
26+
27+
- name: Install dependencies
28+
run: bun install --no-save
29+
30+
- name: Validate schema
31+
run: bun validate:schema
32+
33+
- name: Generate registry types
34+
run: bun generate:types
35+
36+
- name: Validate logic
37+
run: |
38+
if [ -z "${{ env.THEGRAPH_STUDIO_KEY }}" ]; then
39+
echo "Error: secrets.THEGRAPH_STUDIO_KEY is not set - can't validate networks"
40+
exit 1
41+
fi
42+
bun validate:networks
43+
44+
- name: Generate registry
45+
run: bun generate:public
46+
47+
- name: Format
48+
run: bun format
49+
50+
- name: Get version
51+
id: get_version
52+
run: |
53+
VERSION=$(jq -r '.version' package.json)
54+
echo "REGISTRY_VERSION=${VERSION}" >> $GITHUB_ENV
55+
56+
- name: Check if tag exists
57+
id: check_tag
58+
run: |
59+
if git fetch --tags && git tag -l | grep -q "v${{ env.REGISTRY_VERSION }}"; then
60+
echo "Error: Registry v${{ env.REGISTRY_VERSION }} already exists. Bump up the version in package.json to publish"
61+
exit 1
62+
fi
63+
64+
- name: Publish
65+
uses: cloudflare/wrangler-action@v3
66+
with:
67+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
68+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
69+
command: pages deploy public --project-name=graphregistry
70+
71+
- name: Get commit log
72+
run: |
73+
PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
74+
if [ -z "$PREV_TAG" ]; then
75+
CHANGELOG=$(git log --pretty=format:"- %s (@%an) [%h](https://github.com/$GITHUB_REPOSITORY/commit/%H)" --no-merges)
76+
else
77+
CHANGELOG=$(git log --pretty=format:"- %s (@%an) [%h](https://github.com/$GITHUB_REPOSITORY/commit/%H)" --no-merges ${PREV_TAG}..HEAD)
78+
fi
79+
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
80+
echo "$CHANGELOG" >> $GITHUB_ENV
81+
echo "EOF" >> $GITHUB_ENV
82+
83+
- name: Commit and Push Changes
84+
run: |
85+
git config --global user.name 'github-actions[bot]'
86+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
87+
88+
git add .
89+
git commit -m "generate registry v${{ env.REGISTRY_VERSION }} [no ci]" || echo "No changes to commit"
90+
git push
91+
92+
- name: Create tag
93+
run: |
94+
git tag "v${{ env.REGISTRY_VERSION }}"
95+
git push origin "v${{ env.REGISTRY_VERSION }}"
96+
97+
IFS='.' read -r MAJOR MINOR PATCH <<< "${{ env.REGISTRY_VERSION }}"
98+
echo "MAJOR=$MAJOR" >> $GITHUB_ENV
99+
echo "MINOR=$MINOR" >> $GITHUB_ENV
100+
echo "PATCH=$PATCH" >> $GITHUB_ENV
101+
102+
- name: Create GitHub release
103+
uses: actions/create-release@v1
104+
env:
105+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106+
with:
107+
tag_name: "v${{ env.REGISTRY_VERSION }}"
108+
release_name: "v${{ env.REGISTRY_VERSION }}"
109+
body: |
110+
### Networks Registry v${{ env.REGISTRY_VERSION }}
111+
- ${{ env.REGISTRY_ROOT_URL }}/TheGraphNetworksRegistry.json
112+
- ${{ env.REGISTRY_ROOT_URL }}/TheGraphNetworksRegistry_v${{ env.MAJOR }}_x_x.json
113+
- ${{ env.REGISTRY_ROOT_URL }}/TheGraphNetworksRegistry_v${{ env.MAJOR }}_${{ env.MINOR }}_x.json
114+
- ${{ env.REGISTRY_ROOT_URL }}/TheGraphNetworksRegistry_v${{ env.MAJOR }}_${{ env.MINOR }}_${{ env.PATCH }}.json
115+
116+
### Schema v${{ env.MAJOR }}.${{ env.MINOR }}
117+
- ${{ env.REGISTRY_ROOT_URL }}/TheGraphNetworksRegistrySchema_v${{ env.MAJOR }}_${{ env.MINOR }}.json
118+
119+
### Changes
120+
${{ env.CHANGELOG }}
121+
122+
env:
123+
THEGRAPH_STUDIO_KEY: ${{ secrets.THEGRAPH_STUDIO_KEY }}
124+
REGISTRY_ROOT_URL: "https://graphregistry.pages.dev"

.github/workflows/validate.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
on:
2+
pull_request:
3+
types: [opened, synchronize, reopened]
4+
workflow_dispatch:
5+
6+
name: Validate on PR
7+
8+
jobs:
9+
validate-json:
10+
name: Validate JSON files
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Repository
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Bun
17+
uses: oven-sh/setup-bun@v1
18+
with:
19+
bun-version: latest
20+
21+
- name: Install dependencies
22+
run: bun install --no-save
23+
24+
- name: Validate schema
25+
run: bun validate:schema
26+
27+
- name: Validate logic
28+
run: bun validate:networks
29+
30+
- name: Generate registry types
31+
run: bun generate:types
32+
33+
- name: Generate registry
34+
run: bun generate:registry
35+
36+
- name: Validate resulting registry against the schema
37+
run: bun validate:registry
38+

.github/workflows/validate_urls.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
on:
2+
# pull_request:
3+
# types: [opened, synchronize, reopened]
4+
workflow_dispatch:
5+
6+
name: Validate URLs
7+
8+
jobs:
9+
validate-urls:
10+
name: Validate URLs
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Repository
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Bun
17+
uses: oven-sh/setup-bun@v1
18+
with:
19+
bun-version: latest
20+
21+
- name: Install dependencies
22+
run: bun install --no-save
23+
24+
- name: Validate schema
25+
run: bun validate:schema
26+
27+
- name: Validate logic
28+
run: bun validate:networks
29+
30+
- name: Validate URLs
31+
run: bun validate:urls
32+

.github/workflows/version_check.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
on:
2+
pull_request:
3+
types: [opened, synchronize, reopened]
4+
workflow_dispatch:
5+
6+
name: Check version on PR
7+
8+
jobs:
9+
validate-json:
10+
name: Check version
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Repository
14+
uses: actions/checkout@v4
15+
16+
- name: Get version
17+
id: get_version
18+
run: |
19+
VERSION=$(jq -r '.version' package.json)
20+
echo "REGISTRY_VERSION=v${VERSION}" >> $GITHUB_ENV
21+
22+
- name: Check if tag exists
23+
id: check_tag
24+
run: |
25+
TAG="${{ env.REGISTRY_VERSION }}"
26+
if git fetch --tags && git tag -l | grep -q "$TAG"; then
27+
echo "Error: Registry $TAG already exists. Bump up the version in package.json to publish"
28+
exit 1
29+
fi

.gitignore

+132
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
.pnpm-debug.log*
9+
10+
.DS_Store
11+
12+
# Diagnostic reports (https://nodejs.org/api/report.html)
13+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
14+
15+
# Runtime data
16+
pids
17+
*.pid
18+
*.seed
19+
*.pid.lock
20+
21+
# Directory for instrumented libs generated by jscoverage/JSCover
22+
lib-cov
23+
24+
# Coverage directory used by tools like istanbul
25+
coverage
26+
*.lcov
27+
28+
# nyc test coverage
29+
.nyc_output
30+
31+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
32+
.grunt
33+
34+
# Bower dependency directory (https://bower.io/)
35+
bower_components
36+
37+
# node-waf configuration
38+
.lock-wscript
39+
40+
# Compiled binary addons (https://nodejs.org/api/addons.html)
41+
build/Release
42+
43+
# Dependency directories
44+
node_modules/
45+
jspm_packages/
46+
47+
# Snowpack dependency directory (https://snowpack.dev/)
48+
web_modules/
49+
50+
# TypeScript cache
51+
*.tsbuildinfo
52+
53+
# Optional npm cache directory
54+
.npm
55+
56+
# Optional eslint cache
57+
.eslintcache
58+
59+
# Optional stylelint cache
60+
.stylelintcache
61+
62+
# Microbundle cache
63+
.rpt2_cache/
64+
.rts2_cache_cjs/
65+
.rts2_cache_es/
66+
.rts2_cache_umd/
67+
68+
# Optional REPL history
69+
.node_repl_history
70+
71+
# Output of 'npm pack'
72+
*.tgz
73+
74+
# Yarn Integrity file
75+
.yarn-integrity
76+
77+
# dotenv environment variable files
78+
.env
79+
.env.development.local
80+
.env.test.local
81+
.env.production.local
82+
.env.local
83+
84+
# parcel-bundler cache (https://parceljs.org/)
85+
.cache
86+
.parcel-cache
87+
88+
# Next.js build output
89+
.next
90+
out
91+
92+
# Nuxt.js build / generate output
93+
.nuxt
94+
dist
95+
96+
# Gatsby files
97+
.cache/
98+
# Comment in the public line in if your project uses Gatsby and not Next.js
99+
# https://nextjs.org/blog/next-9-1#public-directory-support
100+
# public
101+
102+
# vuepress build output
103+
.vuepress/dist
104+
105+
# vuepress v2.x temp and cache directory
106+
.temp
107+
.cache
108+
109+
# Docusaurus cache and generated files
110+
.docusaurus
111+
112+
# Serverless directories
113+
.serverless/
114+
115+
# FuseBox cache
116+
.fusebox/
117+
118+
# DynamoDB Local files
119+
.dynamodb/
120+
121+
# TernJS port file
122+
.tern-port
123+
124+
# Stores VSCode versions used for testing VSCode extensions
125+
.vscode-test
126+
127+
# yarn v2
128+
.yarn/cache
129+
.yarn/unplugged
130+
.yarn/build-state.yml
131+
.yarn/install-state.gz
132+
.pnp.*

.prettierrc.cjs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
plugins: [
3+
require.resolve("./src/prettier/plugin-no-trailing-slash.cjs"),
4+
],
5+
};

0 commit comments

Comments
 (0)