-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (85 loc) · 2.94 KB
/
deploy-production.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
name: Build and deploy from main
on:
push:
branches:
- main
jobs:
build:
name: Deploy to server from main
runs-on: ubuntu-latest
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
NEXT_PUBLIC_BASE_URL: ${{ secrets.NEXT_PUBLIC_BASE_URL }}
NODE_ENV: ${{ secrets.NODE_ENV }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_ASSISTANT_ID: ${{ secrets.OPENAI_ASSISTANT_ID }}
steps:
- name: Checkout 🛎️
uses: actions/checkout@v1
with:
persist-credentials: false
- name: Use Node.js 18.x
uses: actions/setup-node@v1
with:
node-version: 18.x
- name: Install yarn
uses: mskelton/setup-yarn@v1
with:
node-version: "18.x"
- name: Install dependencies
run: yarn install
- name: Prisma generate
run: yarn prisma generate
- name: Build
run: yarn build
- name: Copy public folder
uses: appleboy/scp-action@master
with:
host: ${{ secrets.PROD_SSH_HOST }}
username: ${{ secrets.PROD_SSH_USER }}
key: ${{ secrets.PROD_SSH_KEY }}
source: "./public"
target: "/var/docker/evokegen/"
- name: Copy standalone folder
uses: appleboy/scp-action@master
with:
host: ${{ secrets.PROD_SSH_HOST }}
username: ${{ secrets.PROD_SSH_USER }}
key: ${{ secrets.PROD_SSH_KEY }}
source: "./.next/standalone/"
target: "/var/docker/evokegen/"
- name: CP standalone to ./
uses: appleboy/[email protected]
with:
host: ${{ secrets.PROD_SSH_HOST }}
username: ${{ secrets.PROD_SSH_USER }}
key: ${{ secrets.PROD_SSH_KEY }}
script: |
sudo cp -R /var/docker/evokegen/.next/standalone/.next/* /var/docker/evokegen/.next/
sudo cp -R /var/docker/evokegen/.next/standalone/* /var/docker/evokegen/
- name: Copy static folder
uses: appleboy/scp-action@master
with:
host: ${{ secrets.PROD_SSH_HOST }}
username: ${{ secrets.PROD_SSH_USER }}
key: ${{ secrets.PROD_SSH_KEY }}
source: "./.next/static"
target: "/var/docker/evokegen/"
- name: Copy Dockerfile
uses: appleboy/scp-action@master
with:
host: ${{ secrets.PROD_SSH_HOST }}
username: ${{ secrets.PROD_SSH_USER }}
key: ${{ secrets.PROD_SSH_KEY }}
source: "Dockerfile,docker-compose.yml"
target: "/var/docker/evokegen/"
- name: executing remote ssh commands using ssh key
uses: appleboy/[email protected]
with:
host: ${{ secrets.PROD_SSH_HOST }}
username: ${{ secrets.PROD_SSH_USER }}
key: ${{ secrets.PROD_SSH_KEY }}
script: |
cd /var/docker/evokegen/
sudo docker build -t evokegen .
sudo docker-compose up -d