forked from Innei/Shiro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
153 lines (139 loc) · 2.87 KB
/
.drone.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
kind: pipeline
name: build-and-package
platform:
os: linux
arch: amd64
volumes:
- name: shiro
host:
path: /drone/tmp/shiro
- name: shiro-dist
host:
path: /drone/tmp/shiro-dist
- name: shiro-env
host:
path: /home/innei/docker-compose/drone/public/shiro/.env
- name: node_modules_cache
host:
path: /drone/tmp/cache
- name: cache
host:
path: /drone/tmp/shiro_next_cache
steps:
- name: restore-cache
image: drillster/drone-volume-cache
settings:
restore: true
mount:
- ./node_modules
volumes:
- name: node_modules_cache
path: /cache
- name: build
image: node:20-alpine
environment:
NODE_OPTIONS: --max_old_space_size=4096
NEXT_TELEMETRY_DISABLED: 1
commands:
- 'npm i -g pnpm'
- 'pnpm install --no-frozen-lockfile'
- 'npm run build:ci'
depends_on:
- restore-cache
volumes:
- name: shiro-env
path: /drone/src/.env
- name: cache
path: /drone/src/.next
- name: rebuild-cache
image: drillster/drone-volume-cache
settings:
rebuild: true
mount:
- ./node_modules
volumes:
- name: node_modules_cache
path: /cache
depends_on:
- build
- name: package
image: node:20-alpine
commands:
- 'pwd'
- 'ls -a'
- 'ls .next'
- 'apk add zip'
- 'sh ./standalone-bundle.sh'
volumes:
- name: shiro-dist
path: /drone/src/assets
- name: cache
path: /drone/src/.next
depends_on:
- build
trigger:
branch:
- main
event:
include:
- push
---
kind: pipeline
name: deploy
platform:
os: linux
arch: amd64
volumes:
- name: shiro-dist
host:
path: /drone/tmp/shiro-dist
steps:
- name: transfer file
image: appleboy/drone-scp
settings:
host:
from_secret: ssh_host
username:
from_secret: ssh_username
key:
from_secret: ssh_key
port: 22
target: /home/deploy/shiro
source:
- assets/release.zip
rm_target: true
strip_components: 1
debug: true
volumes:
- name: shiro-dist
path: /drone/src/assets
- name: deploy
image: appleboy/drone-ssh
settings:
host:
from_secret: ssh_host
username:
from_secret: ssh_username
key:
from_secret: ssh_key
port: 22
script:
- '\npm install --os=linux --cpu=x64 sharp --registry=https://registry.npmmirror.com'
- cd ~/shiro
- unzip -o release.zip
- rm release.zip
- ls
- cd standalone
- cp -r ~/node_modules/sharp ./node_modules
- ~/.n/bin/pm2 restart ecosystem.config.js
debug: true
depends_on:
- transfer file
depends_on:
- build-and-package
trigger:
branch:
- main
event:
include:
- push