|
| 1 | +name: Human Protocol Subgraph Deployment |
| 2 | + |
| 3 | +permissions: |
| 4 | + contents: read |
| 5 | + |
| 6 | +on: |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + label: |
| 10 | + description: "New version label" |
| 11 | + required: true |
| 12 | + networks: |
| 13 | + description: "Comma-separated list of networks to deploy" |
| 14 | + required: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + subgraph: |
| 18 | + name: Deploy Human Protocol Subgraph |
| 19 | + runs-on: ubuntu-latest |
| 20 | + strategy: |
| 21 | + matrix: |
| 22 | + network: |
| 23 | + - name: amoy |
| 24 | + - name: bsc-testnet |
| 25 | + - name: bsc |
| 26 | + - name: ethereum |
| 27 | + - name: polygon |
| 28 | + - name: sepolia |
| 29 | + fail-fast: true |
| 30 | + max-parallel: 3 |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v6 |
| 33 | + - uses: actions/setup-node@v6 |
| 34 | + with: |
| 35 | + node-version-file: .nvmrc |
| 36 | + cache: yarn |
| 37 | + - name: Filter Networks |
| 38 | + id: filter_networks |
| 39 | + run: | |
| 40 | + INPUT_NETWORKS="${{ github.event.inputs.networks }}" |
| 41 | + IFS=',' read -ra NETWORK_LIST <<< "$INPUT_NETWORKS" |
| 42 | + echo "Input networks: $INPUT_NETWORKS" |
| 43 | + echo "Current matrix network: ${{ matrix.network.name }}" |
| 44 | + MATCH=false |
| 45 | + for network in "${NETWORK_LIST[@]}"; do |
| 46 | + if [[ "${network}" == "${{ matrix.network.name }}" ]]; then |
| 47 | + MATCH=true |
| 48 | + break |
| 49 | + fi |
| 50 | + done |
| 51 | + echo "Match found: $MATCH" |
| 52 | + echo "continue=$MATCH" >> "$GITHUB_OUTPUT" |
| 53 | + - name: Install dependencies |
| 54 | + if: steps.filter_networks.outputs.continue == 'true' |
| 55 | + run: yarn workspaces focus @tools/subgraph-human-protocol |
| 56 | + - name: Build packages (scoped) |
| 57 | + if: steps.filter_networks.outputs.continue == 'true' |
| 58 | + run: yarn workspaces foreach -Rpt --from @tools/subgraph-human-protocol run build |
| 59 | + - name: Generate and build Subgraph |
| 60 | + if: steps.filter_networks.outputs.continue == 'true' |
| 61 | + run: yarn generate && yarn build |
| 62 | + working-directory: ./packages/subgraph/human-protocol |
| 63 | + env: |
| 64 | + NETWORK: ${{ matrix.network.name }} |
| 65 | + - name: Authenticate & Deploy |
| 66 | + if: steps.filter_networks.outputs.continue == 'true' |
| 67 | + env: |
| 68 | + API_KEY: ${{ secrets.HP_GRAPH_API_KEY }} |
| 69 | + NETWORK: ${{ matrix.network.name }} |
| 70 | + LABEL: ${{ github.event.inputs.label }} |
| 71 | + working-directory: ./packages/subgraph/human-protocol |
| 72 | + run: | |
| 73 | + yarn dlx @graphprotocol/graph-cli@0.71.2 \ |
| 74 | + auth --studio "$API_KEY" |
| 75 | + yarn dlx @graphprotocol/graph-cli@0.71.2 \ |
| 76 | + deploy --studio human-${NETWORK} -l ${LABEL} |
0 commit comments