Files

62 lines
1.7 KiB
YAML

name: Seeds CI/CD
on:
push:
branches:
- "main"
paths:
- "db/seeds/**"
- "typescript/seeds-scripts/**"
- "typescript/common/**"
- ".github/workflows/database-seeds.yml"
pull_request:
branches:
- "main"
paths:
- "db/seeds/**"
- "typescript/seeds-scripts/**"
- "typescript/common/**"
- ".github/workflows/database-seeds.yml"
workflow_dispatch:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
container:
image: ghcr.io/zkldi/tachi-ci:main
options: --user root
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Run Tests
run: bun run --filter tachi-seeds-scripts test
env:
NODE_ENV: "test"
dispatch-deploy:
# See ../workflows/server.yml for rationale — deploy logs live in server-ceres.
runs-on: ubuntu-latest
needs: [test]
if: ${{ github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') }}
steps:
- name: Dispatch seeds deploy
env:
GH_TOKEN: ${{ secrets.DEPLOY_DISPATCH_TOKEN }}
SHA: ${{ github.sha }}
run: |
gh api repos/zkldi/server-ceres/dispatches \
-f event_type=deploy \
-F "client_payload[app]=seeds" \
-F "client_payload[dest]=-" \
-F "client_payload[sha]=${SHA}"
echo "::notice::Dispatched seeds ${SHA} — logs: https://github.com/zkldi/server-ceres/actions/workflows/tachi-deploy.yml"