-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (47 loc) · 1.59 KB
/
deploy.yml
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
name: Deploy
on:
push:
tags:
- v*.*.*
jobs:
build:
name: Lint, Typecheck, Build, and Deploy
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
- name: Checkout LFS objects
run: git lfs checkout
- name: Setup pnpm
uses: pnpm/[email protected]
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Lint and Typecheck
run: |
pnpm run typecheck
pnpm run lint
- name: Build project
run: pnpm run build:web
- name: Archive production artifacts
run: tar -cvf build.tar -C ./out/web .
- name: Deploy to remote server
env:
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
run: |
echo "${{ secrets.DEPLOY_KEY }}" > deploy_key
chmod 600 deploy_key
scp -i deploy_key -o StrictHostKeyChecking=no build.tar $DEPLOY_USER@$DEPLOY_HOST:/opt/1panel/apps/openresty/openresty/www/sites/marchen-play.suemor.com/index/
ssh -i deploy_key -o StrictHostKeyChecking=no $DEPLOY_USER@$DEPLOY_HOST "cd /opt/1panel/apps/openresty/openresty/www/sites/marchen-play.suemor.com/index/ && tar -xvf build.tar && rm build.tar"