Files
epic-go/.drone.yml
hu xiaotong bf6fdf6183 ci: 添加 Gitea Actions 示例工作流
- 新增 ci.yaml 文件,定义 Gitea Actions 示例
2025-07-09 09:25:46 +08:00

46 lines
1.2 KiB
Go

kind: pipeline
type: docker
name: default
steps:
- name: build
image: golang:1.22
commands:
- go env -w GO111MODULE=on
- go env -w GOPROXY=https://goproxy.cn,direct
- go mod tidy
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o main main.go
- ls -la main
- name: upload
image: appleboy/drone-scp
settings:
host: 193.112.151.199
username: root
password:
from_secret: scp_password
port: 222
source:
- main
# - scripts/start.sh
target: /opt/dockeropt/epic-go
- name: restart epic-go container
image: appleboy/drone-ssh
settings:
host: 193.112.151.199
username: root
password:
from_secret: scp_password
port: 222
script:
- echo "=== 检查文件是否存在 ==="
- ls -la /opt/dockeropt/epic-go/
- echo "=== 检查文件类型 ==="
- file /opt/dockeropt/epic-go/main
- echo "=== 设置执行权限 ==="
- chmod +x /opt/dockeropt/epic-go/main
- echo "=== 检查依赖库 ==="
- ldd /opt/dockeropt/epic-go/main || echo "静态链接或依赖库检查失败"
- echo "=== 重启容器 ==="
- docker restart epic-go