-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (77 loc) · 2.46 KB
/
Copy pathdeploy.yml
File metadata and controls
95 lines (77 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Deploy
on:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: agentcode-production-deploy
cancel-in-progress: false
jobs:
verify:
name: Verify
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 11.11.0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Restore Next.js cache
uses: actions/cache@v4
with:
path: .next/cache
key: ${{ runner.os }}-next-${{ hashFiles('package.json', 'pnpm-lock.yaml') }}-${{ hashFiles('src/**/*', 'challenges/**/*', 'scripts/challenges/**/*', 'prisma/**/*', 'task-worker/**/*', 'tests/**/*', 'next.config.*', 'tsconfig.json', 'vitest.config.ts') }}
restore-keys: |
${{ runner.os }}-next-${{ hashFiles('package.json', 'pnpm-lock.yaml') }}-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Validate Prisma schema
env:
DATABASE_URL: postgresql://agentcode:agentcode@127.0.0.1:5432/agentcode?schema=public
run: |
pnpm exec prisma validate
pnpm exec prisma generate
- name: Validate challenge assets
run: pnpm challenge:validate
- name: Run evaluator fixtures
run: pnpm challenge:fixtures
- name: Test
run: pnpm test
- name: Typecheck
run: pnpm typecheck
- name: Lint
run: pnpm lint
- name: Build
run: pnpm build
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: verify
steps:
- name: Configure SSH
shell: bash
run: |
set -euo pipefail
mkdir -p ~/.ssh
chmod 700 ~/.ssh
printf '%s\n' "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/deploy_key
printf '%s\n' "${{ secrets.DEPLOY_KNOWN_HOSTS }}" > ~/.ssh/known_hosts
chmod 600 ~/.ssh/deploy_key ~/.ssh/known_hosts
- name: Run deployment
shell: bash
run: |
set -euo pipefail
ssh \
-i ~/.ssh/deploy_key \
-o IdentitiesOnly=yes \
-o StrictHostKeyChecking=yes \
"${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}" \
"sudo -n -u agentcode /usr/bin/bash /opt/agentcode/scripts/deploy.sh"