-
Notifications
You must be signed in to change notification settings - Fork 1
112 lines (98 loc) · 3.23 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
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Deploy to production
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
cache: 'pnpm'
- name: Cache Next.js build files
uses: actions/cache@v4
with:
path: apps/home/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-nextjs-
- name: Cache Astro build files
uses: actions/cache@v4
with:
path: |
apps/next-auth/node_modules/.astro
apps/next-introdutorio/node_modules/.astro
apps/ts-no-react/node_modules/.astro
apps/zod/node_modules/.astro
apps/react-hook-form/node_modules/.astro
apps/react-intro/node_modules/.astro
key: ${{ runner.os }}-astro-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-astro-
- run: pnpm install
- name: Build Projects
run: pnpm -r run build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
apps/home/dist/
apps/next-auth/dist/
apps/next-introdutorio/dist/
apps/ts-no-react/dist/
apps/zod/dist/
apps/react-hook-form/dist/
apps/react-intro/dist/
# Add more apps as needed
deploy:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
app:
- name: 'home'
path: './home/dist/'
remote_path: '/var/www/guias/home/'
- name: 'next-auth'
path: './next-auth/dist/'
remote_path: '/var/www/guias/next-auth/'
- name: 'next-introdutorio'
path: './next-introdutorio/dist/'
remote_path: '/var/www/guias/next-introdutorio/'
- name: 'ts-no-react'
path: './ts-no-react/dist/'
remote_path: '/var/www/guias/ts-no-react/'
- name: 'zod'
path: './zod/dist/'
remote_path: '/var/www/guias/zod/'
- name: 'react-hook-form'
path: './react-hook-form/dist/'
remote_path: '/var/www/guias/react-hook-form/'
- name: 'react-intro'
path: './react-intro/dist/'
remote_path: '/var/www/guias/react-intro/'
# Add more apps as needed
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: .
- name: List All Files after downloading artifacts (excluding node_modules)
run: find . -type d -name node_modules -prune -o -type f -print
- name: Deploy with rsync
uses: burnett01/[email protected]
with:
switches: -avzr --quiet --delete
path: ${{ matrix.app.path }}
remote_path: ${{ matrix.app.remote_path }}
remote_host: ${{ secrets.HOST }}
remote_user: ${{ secrets.USERNAME }}
remote_key: ${{ secrets.SSH_KEY }}