|
7 | 7 | description: "The subgraph version to deploy. For example, 1.34.0. The given number should correspond to an existing tag @bosonprotocol/subgraph@<VERSION>" |
8 | 8 | required: true |
9 | 9 |
|
10 | | -# Deployments wait for the new version to be synced, so a run can last hours: queue |
11 | | -# overlapping runs instead of cancelling one in the middle of a tag move |
12 | | -concurrency: |
13 | | - group: deploy-prod-subgraph |
14 | | - cancel-in-progress: false |
| 10 | +permissions: |
| 11 | + contents: read |
15 | 12 |
|
| 13 | +# Every network is deployed by its own job, so that a network which fails to deploy does |
| 14 | +# not hold back the others. Indexing the new version takes far longer than a job may run, |
| 15 | +# so no job waits for it: each deployment is flagged in a repository variable, and the |
| 16 | +# 'Promote deployed subgraphs' schedule moves the 'latest' tag once the version is indexed. |
16 | 17 | jobs: |
17 | | - deploy: |
18 | | - name: Deploy ${{ matrix.label }} subgraph |
| 18 | + deploy-ethereum: |
| 19 | + name: Deploy Ethereum subgraph |
19 | 20 | runs-on: ubuntu-latest |
20 | | - # Each network gets its own runner, so the whole job budget is available for a |
21 | | - # single GOLDSKY_SYNC_TIMEOUT_MINUTES wait plus the install and build steps |
22 | | - timeout-minutes: 350 |
23 | | - strategy: |
24 | | - # A network that fails to sync must not cancel the others |
25 | | - fail-fast: false |
26 | | - matrix: |
27 | | - include: |
28 | | - - network: ethereum |
29 | | - label: Ethereum |
30 | | - - network: base |
31 | | - label: Base |
| 21 | + timeout-minutes: 45 |
| 22 | + # Do not let two runs deploy the same subgraph at the same time, and never cancel one |
| 23 | + # mid-deployment |
| 24 | + concurrency: |
| 25 | + group: subgraph-deploy-production-ethereum |
| 26 | + cancel-in-progress: false |
32 | 27 | steps: |
33 | 28 | - uses: actions/checkout@v3 |
34 | 29 | with: |
35 | 30 | token: ${{ secrets.BSNORG_ACTIONS_SECRET }} |
36 | 31 | ref: "@bosonprotocol/subgraph@${{ inputs.version }}" |
37 | 32 | fetch-depth: "0" |
38 | | - - uses: actions/setup-node@v3 |
39 | | - with: |
40 | | - # Must stay on the Node (and so npm) version pinned by the root |
41 | | - # package.json volta config: npm 11 and npm 10 resolve the root |
42 | | - # typescript override differently, and no single lock file |
43 | | - # satisfies both, so `npm ci` fails on whichever is out of step. |
44 | | - node-version: "22" |
45 | | - cache: "npm" |
46 | | - - name: Turbo Cache |
47 | | - id: turbo-cache |
48 | | - uses: actions/cache@v3 |
| 33 | + - uses: ./.github/actions/setup-subgraph |
| 34 | + # Deploys the new version and watches it for a few minutes, long enough to catch a |
| 35 | + # deployment that cannot index at all. The 'latest' tag is left on the version |
| 36 | + # currently served: moving it is the promotion schedule's business. |
| 37 | + - id: deploy |
| 38 | + name: Deploy subgraph |
| 39 | + run: cd ./packages/subgraph && npm run deploy:production:ethereum |
| 40 | + env: |
| 41 | + GOLDSKY_API_KEY: ${{ secrets.GOLDSKY_API_KEY_PRODUCTION }} |
| 42 | + GOLDSKY_FATAL_ERROR_WATCH_MINUTES: "5" |
| 43 | + - name: Flag the deployment for promotion |
| 44 | + env: |
| 45 | + GH_TOKEN: ${{ secrets.BSNORG_ACTIONS_SECRET }} |
| 46 | + run: gh variable set SUBGRAPH_PENDING_PRODUCTION_ETHEREUM --repo "$GITHUB_REPOSITORY" --body "${{ steps.deploy.outputs.version }}" |
| 47 | + |
| 48 | + deploy-base: |
| 49 | + name: Deploy Base subgraph |
| 50 | + runs-on: ubuntu-latest |
| 51 | + timeout-minutes: 45 |
| 52 | + concurrency: |
| 53 | + group: subgraph-deploy-production-base |
| 54 | + cancel-in-progress: false |
| 55 | + steps: |
| 56 | + - uses: actions/checkout@v3 |
49 | 57 | with: |
50 | | - path: .turbo |
51 | | - key: turbo-${{ runner.os }}-${{ github.sha }} |
52 | | - restore-keys: | |
53 | | - turbo-${{ runner.os }} |
54 | | - - run: npm ci |
55 | | - - id: build |
56 | | - run: npm run build -- --cache-dir=".turbo" |
57 | | - # GOLDSKY_WAIT_FOR_SYNC makes the 'latest' tag move - and the previously tagged |
58 | | - # version get deleted - only once the new version is synced and healthy |
59 | | - - name: Deploy subgraph |
60 | | - run: cd ./packages/subgraph && npm run deploy:production:${{ matrix.network }} |
| 58 | + token: ${{ secrets.BSNORG_ACTIONS_SECRET }} |
| 59 | + ref: "@bosonprotocol/subgraph@${{ inputs.version }}" |
| 60 | + fetch-depth: "0" |
| 61 | + - uses: ./.github/actions/setup-subgraph |
| 62 | + - id: deploy |
| 63 | + name: Deploy subgraph |
| 64 | + run: cd ./packages/subgraph && npm run deploy:production:base |
61 | 65 | env: |
62 | 66 | GOLDSKY_API_KEY: ${{ secrets.GOLDSKY_API_KEY_PRODUCTION }} |
63 | | - GOLDSKY_WAIT_FOR_SYNC: "true" |
64 | | - GOLDSKY_SYNC_TIMEOUT_MINUTES: "300" |
| 67 | + GOLDSKY_FATAL_ERROR_WATCH_MINUTES: "5" |
| 68 | + - name: Flag the deployment for promotion |
| 69 | + env: |
| 70 | + GH_TOKEN: ${{ secrets.BSNORG_ACTIONS_SECRET }} |
| 71 | + run: gh variable set SUBGRAPH_PENDING_PRODUCTION_BASE --repo "$GITHUB_REPOSITORY" --body "${{ steps.deploy.outputs.version }}" |
0 commit comments