Files
pezkuwi-subquery/.github/workflows/deploy.yml
T
Satoshi Qazi Muhammed 7ec6d9971f ci: deploy over a pinned, single-purpose key instead of root
deploy-vps reached subquery1 as root, through appleboy/ssh-action referenced
by tag, with a key whose comment (mamostehp@MamostePC) made it look like a
person's. It now uses plain ssh with SUBQUERY_DEPLOY_KEY, which the host pins
(authorized_keys restrict,command=) to ops/host/subquery-deploy-ssh: the
commit SHA is its only input. subquery-deploy, run through sudo, does what
the workflow's script did, with three changes:

- It deploys exactly the SHA CI was triggered for, and only a commit on main.
- The host's local edits to tracked files (the indexer manifests) are put
  back whether the deploy succeeds or fails. Before, a failed build exited
  before `stash pop` and left them stashed.
- Only tracked files are stashed. Stashing untracked ones too (.yarn/, which
  yarn install recreates) made every pop fail half-way; that is how 13 stash
  entries piled up on the host.

test-deploy.sh covers this against a scratch clone (red with the restore
trap removed); CI runs it with shellcheck. subquery1's host key is pinned.
The indexer endpoints themselves are unchanged. Actions pinned to SHAs; the
secret scanner's own AGPL licence is allowed in dependency review.
2026-10-09 06:57:03 +04:00

77 lines
2.1 KiB
YAML

name: Deploy to SubQuery Network
on:
release:
types: [published]
workflow_dispatch:
inputs:
project:
description: 'Project to deploy'
required: true
default: 'all'
type: choice
options:
- all
- pezkuwi
- pezkuwi-assethub
env:
SUBQL_ACCESS_TOKEN: ${{ secrets.SUBQL_ACCESS_TOKEN }}
jobs:
deploy-pezkuwi:
if: ${{ github.event_name == 'release' || github.event.inputs.project == 'all' || github.event.inputs.project == 'pezkuwi' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '18'
- name: Enable Corepack
run: corepack enable
- name: Install dependencies
run: yarn install --immutable
- name: Generate types
run: ./node_modules/.bin/subql codegen pezkuwi.yaml
- name: Build
run: ./node_modules/.bin/subql build pezkuwi.yaml
- name: Publish Pezkuwi Relay
run: ./node_modules/.bin/subql publish -f pezkuwi.yaml
deploy-assethub:
if: ${{ github.event_name == 'release' || github.event.inputs.project == 'all' || github.event.inputs.project == 'pezkuwi-assethub' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '18'
- name: Enable Corepack
run: corepack enable
- name: Install dependencies
run: yarn install --immutable
- name: Generate types
run: ./node_modules/.bin/subql codegen pezkuwi.yaml
- name: Build
run: ./node_modules/.bin/subql build pezkuwi.yaml
- name: Publish Pezkuwi Asset Hub
run: ./node_modules/.bin/subql publish -f pezkuwi-assethub.yaml