1
This commit is contained in:
@@ -22,13 +22,23 @@ clone:
|
||||
steps:
|
||||
# SSH初始化步骤
|
||||
init-ssh:
|
||||
image: alpine:latest
|
||||
image: alpine/git:latest
|
||||
environment:
|
||||
WOODPECKER_SSH_KEY:
|
||||
from_secret: WOODPECKER_SSH_KEY
|
||||
commands:
|
||||
- mkdir -p /root/.ssh
|
||||
- touch /root/.ssh/known_hosts
|
||||
- chmod 600 /root/.ssh/known_hosts
|
||||
# 如果需要的话,可以添加远程主机到known_hosts
|
||||
# ssh-keyscan -H <your-remote-host> >> /root/.ssh/known_hosts
|
||||
- |
|
||||
# 设置SSH
|
||||
mkdir -p ~/.ssh
|
||||
echo "$${WOODPECKER_SSH_KEY}" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
|
||||
ssh-keyscan -H bitbucket.org >> ~/.ssh/known_hosts
|
||||
ssh-keyscan -H gitlab.com >> ~/.ssh/known_hosts
|
||||
|
||||
# 配置git
|
||||
git config --global user.name "Woodpecker CI"
|
||||
git config --global user.email "ci@example.com"
|
||||
|
||||
# 1. 缓存Go依赖(加速构建)
|
||||
cache-go-mod:
|
||||
|
||||
Reference in New Issue
Block a user