-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy path.drone.yaml
66 lines (58 loc) · 1.28 KB
/
.drone.yaml
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
kind: pipeline
type: docker
name: gostc-admin
platform:
os: linux
arch: amd64
steps:
- name: build-web
image: node:18
volumes:
- name: npm-cache
path: /drone/src/web/node_modules
commands:
- mkdir output
- cd web
- npm install
- npm run build
- mv dist ../output/
- name: build-web-zip
image: alpine:latest
commands:
- cd output
- apk add zip
- zip -r dist.zip dist
- name: build-server
image: golang:1.23-alpine
volumes:
- name: go-cache
path: /go/pkg/mod/
commands:
- cd server
- mv ../output/dist.zip ./web/
- go env -w GO111MODULE=on
- go env -w GOPROXY=https://goproxy.cn,direct
- go mod tidy
- go build -ldflags "-s -w" -o ../output/server main.go
- name: docker-build-push
image: plugins/docker
settings:
registry: harbor.sian.one
repo: harbor.sian.one/gostc/gostc-admin
username:
from_secret: HARBOR_USERNAME
password:
from_secret: HARBOR_PASSWORD
tags:
- latest
dockerfile: Dockerfile
volumes:
- name: go-cache
host:
path: /home/drone/build/go-cache/
- name: npm-cache
host:
path: /home/drone/build/npm-cache/
trigger:
branch:
- master