支援 Drone、Woodpecker、GitHub Actions 和 Gitea Actions 的 CI/CD 插件,用於將更改推送到遠端 Git 儲存庫。
| CI 平台 | 狀態 |
|---|---|
| Drone | 完整支援 |
| Woodpecker | 完整支援 |
| GitHub Actions | 完整支援 |
| Gitea Actions | 完整支援 |
基本推送到遠端分支:
- name: push commit
image: appleboy/drone-git-push
settings:
branch: master
remote: git@github.com:foo/bar.git
ssh_key:
from_secret: deploy_key
推送並提交變更:
- name: push commit
image: appleboy/drone-git-push
settings:
branch: master
remote: git@github.com:foo/bar.git
force: false
commit: true
commit_message: "[skip ci] Update generated files"
ssh_key:
from_secret: deploy_key
推送到當前儲存庫:
- name: push commit
image: appleboy/drone-git-push
settings:
remote_name: origin
branch: gh-pages
local_ref: gh-pages
鏡像所有 refs 到遠端儲存庫:
- name: mirror push
image: appleboy/drone-git-push
settings:
remote: git@github.com:foo/bar-mirror.git
mirror: true
ssh_key:
from_secret: deploy_key
推送並加上標籤:
- name: push with tag
image: appleboy/drone-git-push
settings:
branch: master
remote: git@github.com:foo/bar.git
commit: true
tag: v1.0.0
followtags: true
ssh_key:
from_secret: deploy_key
- name: Push changes
uses: appleboy/drone-git-push@master
with:
remote: git@github.com:foo/bar.git
branch: master
ssh_key: ${{ secrets.DEPLOY_KEY }}
- name: Push changes
uses: appleboy/drone-git-push@master
with:
remote: git@gitea.com:foo/bar.git
branch: master
ssh_key: ${{ secrets.DEPLOY_KEY }}
| 參數 | 說明 | 預設值 |
|---|---|---|
ssh_key |
遠端主機的私有 SSH 金鑰 | - |
remote |
目標遠端儲存庫 URL | - |
remote_name |
本地使用的遠端名稱 | deploy |
branch |
目標遠端分支 | master |
local_branch |
要推送的本地分支或 ref | HEAD |
path |
Git 儲存庫路徑 | 當前目錄 |
force |
使用 --force 強制推送 |
false |
skip_verify |
跳過 HTTPS 憑證驗證 | false |
commit |
推送前新增並提交內容 | false |
commit_message |
自訂提交訊息 | [skip ci] Commit dirty state |
empty_commit |
建立空提交 | false |
no_verify |
略過 pre-commit 和 commit-msg | false |
tag |
要加到提交的標籤 | - |
followtags |
使用 --follow-tags 選項推送 |
false |
rebase |
推送前執行 --rebase |
false |
mirror |
使用 --mirror 推送所有 refs |
false |
author_name |
提交的作者名稱 | CI 提交作者 |
author_email |
提交的作者電子郵件 | CI 提交作者電子郵件 |
提供私有 SSH 金鑰進行認證:
settings:
ssh_key:
from_secret: deploy_key
使用 netrc 憑證進行 HTTPS 認證:
settings:
username:
from_secret: git_username
password:
from_secret: git_password
建置二進位檔:
go build
go test
建置 Docker 映像檔:
# 建置 Linux amd64 版本
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/amd64/drone-git-push
# 建置 Docker 映像檔
docker build --rm -t appleboy/drone-git-push -f docker/Dockerfile .
docker run --rm \
-e DRONE_COMMIT_AUTHOR=Octocat \
-e DRONE_COMMIT_AUTHOR_EMAIL=octocat@github.com \
-e PLUGIN_SSH_KEY="$(cat "${HOME}/.ssh/id_rsa")" \
-e PLUGIN_BRANCH=master \
-e PLUGIN_REMOTE=git@github.com:foo/bar.git \
-e PLUGIN_FORCE=false \
-v "$(pwd):$(pwd)" \
-w "$(pwd)" \
appleboy/drone-git-push
MIT 授權條款 - 詳見 LICENSE 檔案。
$ claude mcp add drone-git-push \
-- python -m otcore.mcp_server <graph>