ci: 添加 Gitea Actions 示例工作流

- 新增 ci.yaml 文件,定义 Gitea Actions 示例
This commit is contained in:
hu xiaotong
2025-07-09 08:03:02 +08:00
parent 05531f9524
commit 03de4e8c85

View File

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