-
Notifications
You must be signed in to change notification settings - Fork 10
ci: add deploy workflow for TheGraph Network #471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
103fbef
187b6a7
2f66ee3
abbc35d
7288fe2
be77f70
e689dc3
e960c35
e308f0f
c3ea6fa
b33d638
b4e0e0f
b3787f4
d4aee0d
615a3e7
9230937
30c0f17
c69b56c
503ab67
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| name: Deploy Subgraph - on TheGraph Network | ||
|
|
||
| on: | ||
| workflow_dispatch: # Manual trigger | ||
| inputs: | ||
| network: | ||
| description: 'Network' | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - arbitrumSepolia | ||
| - arbitrum | ||
| version_label: | ||
| description: 'Version label for the subgraph deployment' | ||
| required: true | ||
| type: string | ||
|
|
||
| jobs: | ||
| build-and-test: | ||
| uses: ./.github/workflows/subgraph-ci.yml | ||
| with: | ||
| node-version: 20 | ||
| deploy: | ||
| needs: build-and-test | ||
| runs-on: ubuntu-latest | ||
| # Associate the job with a GitHub Environment which has pre-defined variables and secrets. | ||
| environment: ${{ github.event.inputs.network }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
Le-Caignec marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - name: Install dependencies | ||
| working-directory: packages/subgraph | ||
| run: npm ci | ||
|
|
||
| - name: Codegen | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. duplicate from subrsubgraph-ci.yml
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, that’s true — but we need it to make the deploy command work. |
||
| working-directory: packages/subgraph | ||
| run: npm run codegen | ||
|
|
||
| - name: Deploy Subgraph | ||
| working-directory: packages/subgraph | ||
| env: | ||
| SUBGRAPH_DEPLOY_KEY: ${{ secrets.SUBGRAPH_DEPLOY_KEY }} | ||
| SUBGRAPH_NETWORK_NAME: ${{ vars.SUBGRAPH_NETWORK_NAME }} | ||
| SUBGRAPH_SLUG: ${{ vars.SUBGRAPH_SLUG }} | ||
| VERSION_LABEL: ${{ github.event.inputs.version_label }} | ||
| run: npm run deploy-chainX | ||
|
|
||
| - name: Deployment Success | ||
| run: | | ||
| echo "🎉 Subgraph deployment completed successfully!" | ||
| echo "📋 Next steps:" | ||
| echo "1. Go to TheGraph Studio: https://thegraph.com/studio/" | ||
| echo "2. Connect with the iExec wallet" | ||
| echo "3. Publish the subgraph to make it publicly available" | ||
| echo "4. Subgraph details:" | ||
| echo " - Slug: ${{ vars.SUBGRAPH_SLUG }}" | ||
| echo " - Network: ${{ vars.SUBGRAPH_NETWORK_NAME }}" | ||
| echo " - Version: ${{ github.event.inputs.version_label }}" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| name: Core Smart Contract - Default | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - '*' | ||
| paths: | ||
| - 'packages/subgraph/**' | ||
| workflow_call: | ||
| inputs: | ||
| node-version: | ||
| description: Node.js version to use | ||
| required: false | ||
| type: number | ||
| default: 20 | ||
|
|
||
| concurrency: | ||
| group: ${{ github.ref }}-subgraph-ci | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build-and-test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ inputs.node-version }} | ||
| cache: 'npm' | ||
| cache-dependency-path: 'packages/subgraph' | ||
|
|
||
| - name: Install dependencies | ||
| working-directory: packages/subgraph | ||
| run: npm ci | ||
|
|
||
| - name: Check Format | ||
| working-directory: packages/subgraph | ||
| run: npm run check-format | ||
|
|
||
| - name: Codegen | ||
| working-directory: packages/subgraph | ||
| run: npm run codegen | ||
|
|
||
| # TODO: fix test command | ||
| # - name: Run unit tests | ||
| # working-directory: packages/subgraph | ||
| # run: npm run test | ||
|
|
||
| - name: Build | ||
| working-directory: packages/subgraph | ||
| run: npm run build |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ | |
| "scripts": { | ||
| "codegen": "graph codegen subgraph.template.yaml", | ||
| "build": "dotenv -e .env -- sh -c 'graph codegen subgraph.template.yaml && graph build subgraph.template.yaml --network ${NETWORK_NAME:-bellecour}'", | ||
| "deploy-theGraph": "graph deploy --node https://api.thegraph.com/deploy/ DataProtector", | ||
| "deploy-chainX": "dotenv -e .env -- sh -c 'graph deploy ${SUBGRAPH_SLUG} subgraph.template.yaml --deploy-key ${SUBGRAPH_DEPLOY_KEY} --network ${SUBGRAPH_NETWORK_NAME} --version-label ${VERSION_LABEL}'", | ||
|
||
| "create": "dotenv -e .env -- sh -c 'graph create --node ${GRAPHNODE_URL:-http://localhost:8020} ${NETWORK_NAME:-bellecour}${DEPLOY_ENV:-/}dataprotector-v2'", | ||
| "deploy": "dotenv -e .env -- sh -c 'graph deploy ${NETWORK_NAME:-bellecour}${DEPLOY_ENV:-/}dataprotector-v2 subgraph.template.yaml --node ${GRAPHNODE_URL:-http://localhost:8020} --ipfs ${IPFS_URL:-http://localhost:5001} --network ${NETWORK_NAME:-bellecour} --version-label ${VERSION_LABEL:-dev}'", | ||
| "clean": "rm -rf generated && rm -rf build", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m not a big fan of this ci file name. If you have a better suggestion, let me know!