-
Notifications
You must be signed in to change notification settings - Fork 7
86 lines (71 loc) · 2.14 KB
/
client-ci-cd.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
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
name: Client CI/CD
on:
push:
branches: [develop]
paths:
- 'client/**'
- 'core/**'
- '.github/workflows/client-ci-cd.yml'
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: '9'
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build Core Package
working-directory: ./core
run: pnpm build
- name: Lint Client
working-directory: ./client
run: pnpm lint | true
- name: Test Client
working-directory: ./client
run: pnpm test | true
- name: Build Client
working-directory: ./client
env:
VITE_API_URL: ${{secrets.VITE_API_URL}}
VITE_SOCKET_URL: ${{secrets.VITE_SOCKET_URL}}
run: pnpm build
docker-deploy:
needs: ci
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Docker Setup
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile.nginx
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/troublepainter-nginx:latest
build-args: |
VITE_API_URL=${{secrets.VITE_API_URL}}
VITE_SOCKET_URL=${{secrets.VITE_SOCKET_URL}}
- name: Deploy to Server
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: mira
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/troublepainter-nginx:latest
cd /home/mira/web30-stop-troublepainter
docker compose up -d nginx