diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..d7fcd0b --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,11 @@ +# Description + +Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. + +Fixes # (issue) + +# Checklist + +- [ ] Ran `yarn prepare:arbitrum-one` and verified `graph codegen` and `graph build` succeed. +- [ ] (Optional) Validated locally with `yarn deploy:local`. +- [ ] Confirmed the Subgraph Studio preview link in the PR comment works and the subgraph syncs without errors. diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7470693..cc92bf9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -7,6 +7,8 @@ on: push: branches: - main + tags: + - "*" jobs: deploy: @@ -67,14 +69,18 @@ jobs: ${{ steps.deploy_preview.outputs.studio_query_url }} ``` - # NOTE: disabled until Goerli testnet is deployed - # - name: Deploy to Arbitrum Goerli - # if: github.ref != 'refs/heads/main' - # run: yarn deploy:arbitrum-goerli --deploy-key $SUBGRAPH_ACCESS_TOKEN + # # NOTE: disabled until testnet is deployed + # - name: Deploy to Arbitrum Goerli (main) + # if: github.ref == 'refs/heads/main' && github.event_name == 'push' # env: - # SUBGRAPH_ACCESS_TOKEN: ${{ secrets.SUBGRAPH_ACCESS_TOKEN }} - - name: Deploy to Arbitrum One - if: github.ref == 'refs/heads/main' && github.event_name == 'push' + # DEPLOY_KEY: ${{ secrets.ARBITRUM_GOERLI_DEPLOY_KEY }} + # VERSION_LABEL: ${{ steps.short_sha.outputs.short_sha }} + # run: | + # yarn deploy:arbitrum-goerli -- --version-label "$VERSION_LABEL" --deploy-key "$DEPLOY_KEY" + - name: Deploy to Arbitrum One (tag) + if: startsWith(github.ref, 'refs/tags/') env: - ARBITRUM_ONE_DEPLOY_KEY: ${{ secrets.ARBITRUM_ONE_DEPLOY_KEY }} - run: yarn deploy:arbitrum-one --deploy-key $ARBITRUM_ONE_DEPLOY_KEY + DEPLOY_KEY: ${{ secrets.ARBITRUM_ONE_DEPLOY_KEY }} + VERSION_LABEL: ${{ github.ref_name }} + run: | + yarn deploy:arbitrum-one -- --version-label "$VERSION_LABEL" --deploy-key "$DEPLOY_KEY" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..105aade --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,40 @@ +# Contributing + +Thanks for your interest in contributing to our subgraph. We want this to be friendly, clear, +and low-friction for everyone. + +## Ways to contribute + +- Report a bug or regression. +- Propose a feature or improvement. +- Improve docs or tests. +- Help with reviews. + +## Issues first, then assignments + +For most work, please open an issue before starting: + +1. Create or find the issue. +2. Ask to be assigned in a comment. +3. Wait for a maintainer to assign you before starting work. + +This helps us avoid duplicated effort and align on scope. + +## Pull request workflow + +1. Fork the repo and create your branch from the default branch. +2. Keep changes focused and scoped to the issue. +3. Add tests or update docs where appropriate. +4. Open a PR and link the issue it resolves. + +## Deployment workflow + +1. CI deploys a Subgraph Studio preview and posts the link as a PR comment. +2. Reviewers should confirm the Studio deployment fully syncs without errors. +3. After approval, merge to `main` to trigger a testnet deployment (if enabled). +4. Tag releases publish to the on-chain Graph Network (any tag triggers the workflow). + +## License + +By contributing, you agree that your contributions will be licensed under the +license specified in this repository. diff --git a/README.md b/README.md index 291ef7f..a66bdec 100755 --- a/README.md +++ b/README.md @@ -23,10 +23,23 @@ each network (arbitrum-one and arbitrum-goerli). The network can be changed via `NETWORK_NAME` environment variable or directly by choosing a different "prepare" script. See [package.json](./package.json) for all options. -### Deploy the Livepeer Subgraph to the Graph's hosted service (recommended) +### Deploy the Livepeer Subgraph with Subgraph Studio -Follow the instructions documented -[here](https://thegraph.com/docs/deploy-a-subgraph). +Deploy to Subgraph Studio first, then publish to the decentralized Graph Network +from the Studio UI. For more information, see the [Subgraph Studio +documentation](https://thegraph.com/docs/en/subgraphs/developing/deploying/using-subgraph-studio/). + +Example deploy: + +```bash +yarn deploy:arbitrum-one -- --version-label --deploy-key +``` + +You can also override the subgraph name for the generic deploy script: + +```bash +SUBGRAPH=livepeer/arbitrum-one yarn deploy -- --version-label --deploy-key +``` ### Deploy the Livepeer Subgraph locally diff --git a/package.json b/package.json index 8f6f9ad..46e8672 100644 --- a/package.json +++ b/package.json @@ -8,11 +8,11 @@ "codegen": "graph codegen --output-dir src/types/", "create:docker": "graph create livepeer/livepeer --node http://graph-node:8020", "create:local": "graph create livepeer/livepeer --node http://127.0.0.1:8020", - "deploy:arbitrum-one": "yarn prepare:arbitrum-one && SUBGRAPH=livepeer/arbitrum-one yarn deploy", - "deploy:arbitrum-goerli": "yarn prepare:arbitrum-goerli && SUBGRAPH=livepeer/arbitrum-goerli yarn deploy", + "deploy:arbitrum-one": "yarn prepare:arbitrum-one && graph deploy livepeer", + "deploy:arbitrum-goerli": "yarn prepare:arbitrum-goerli && graph deploy livepeer/arbitrum-goerli", "deploy:docker": "yarn prepare:development && graph deploy livepeer/livepeer -l \"v0.0.1\" --ipfs http://ipfs:5001 --node http://graph-node:8020", "deploy:local": "yarn prepare:development && graph deploy livepeer/livepeer -l \"v0.0.1\" --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020", - "deploy": "graph deploy $SUBGRAPH --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/", + "deploy": "graph deploy ${SUBGRAPH:-livepeer}", "docker:build": "docker build --cache-from livepeer/subgraph:latest -t livepeer/subgraph:latest .", "prepare:arbitrum-one": "TS_NODE_PROJECT='./tsconfig.hardhat.json' NETWORK_NAME=arbitrum-one ts-node ./templatify.ts", "prepare:arbitrum-goerli": "TS_NODE_PROJECT='./tsconfig.hardhat.json' NETWORK_NAME=arbitrum-goerli ts-node ./templatify.ts",