-
Notifications
You must be signed in to change notification settings - Fork 6
46 lines (37 loc) · 1019 Bytes
/
Copy pathci-cd.yaml
File metadata and controls
46 lines (37 loc) · 1019 Bytes
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
name: CI CD - Whim
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
name: CI - Whim Lint & Build
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build
run: bun run build
deploy:
name: CD - Whim Deploy
runs-on: ubuntu-22.04
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Setup SSH key
uses: webfactory/ssh-agent@v0.9.1
with:
ssh-private-key: ${{ secrets.VPS_KEY }}
- name: SSH and Deploy
run: |
ssh -o StrictHostKeyChecking=no ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }} << 'EOF'
cd whim
git pull origin main
docker compose up --build -d
docker compose restart caddy
EOF