Merge remote-tracking branch 'origin/master'

# Conflicts:
#	.drone.yml
This commit is contained in:
hu xiaotong
2025-07-09 08:02:51 +08:00

View File

@@ -3,34 +3,60 @@ type: docker
name: default
steps:
- name: restore cache
image: drillster/drone-volume-cache
volumes:
- name: go-mod-cache
path: /opt/drone/cache/go-mod
- name: go-build-cache
path: /opt/drone/cache/go-build
settings:
restore: true
mount:
- /opt/drone/cache/go-mod
- /opt/drone/cache/go-build
backend: local
cache_key: go-mod-cache-${DRONE_BRANCH}
- name: build
image: golang:1.22
commands:
- go env -w GO111MODULE=on
- go env -w GOPROXY=https://goproxy.cn,direct
- go mod tidy
- go build -v -o main main.go
- mkdir -p /opt/drone/cache/go-mod
- echo "drone test" > /opt/drone/cache/go-mod/drone_testfile
- ls -lR /opt/drone/cache/go-mod
- name: upload
image: appleboy/drone-scp
- name: rebuild cache
image: drillster/drone-volume-cache
volumes:
- name: go-mod-cache
path: /opt/drone/cache/go-mod
- name: go-build-cache
path: /opt/drone/cache/go-build
settings:
host: 193.112.151.199
username: root
password:
from_secret: scp_password
port: 222
source:
- main.exe
- scripts/start.sh
target: /opt/dockeropt/epic-go
rebuild: true
mount:
- /opt/drone/cache/go-mod
- /opt/drone/cache/go-build
backend: local
cache_key: go-mod-cache-${DRONE_BRANCH}
- name: restart epic-go container
image: appleboy/ssh
settings:
host: 193.112.151.199
username: root
password:
from_secret: scp_password
port: 222
script:
- docker restart epic-go
# 可选远程重启服务
# - name: restart
# image: appleboy/ssh
# settings:
# host: 你的服务器IP或域名
# username: 你的SSH用户名
# password:
# from_secret: scp_password
# port: 22
# script:
# - cd /your/deploy/path/
# - chmod +x start.sh
# - ./start.sh
volumes:
- name: go-mod-cache
host:
path: /opt/drone/cache/go-mod
- name: go-build-cache
host:
path: /opt/drone/cache/go-build