From 6e2ba16cbfdb0b99970639304b8b72d2332e29db Mon Sep 17 00:00:00 2001 From: Endial Fang Date: Wed, 7 Jan 2026 14:13:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=B4=E6=98=8E=E6=96=87?= =?UTF-8?q?=E6=A1=A3=20[SKIP=20CI]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..afce5a5 --- /dev/null +++ b/README.md @@ -0,0 +1,69 @@ +编译hello-world二进制文件: + +```bash +CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o hello-world-linux-amd64 ./hello-world +CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o hello-world-linux-arm64 ./hello-world + +CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o hello-world-darwin-amd64 ./hello-world +CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o hello-world-darwin-arm64 ./hello-world + +CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o hello-world.exe ./hello-world +``` + +GOOS 可选值: + +```bash +go tool dist list +``` + +# 🔐 Secrets 配置(在 Drone UI 中设置) +--- +kind: secret +name: registry_username +data: +--- + +kind: secret +name: registry_password +data: + +💡 使用 drone-cli 示例: + +```bash +drone secret add \ + --repository your-org/your-repo \ + --name registry_username \ + --data your-user +``` + +## Git Submodule + +项目基于 [Git Submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules) 挂载通用编译脚本时,可使用以下命令进行管理: + +```bash +# 新创建项目增加 Submodule 配置 +git submodule add https://git.colovu.com/docker/common.git .ci/common + +# 删除 Submodule 配置 +git submodule deinit .ci/common +git rm .ci/common +rm -rf .git/modules/.ci/common +rm -rf .ci/common +git commit -m "remove .ci/common" +git push + +# 已检出项目,初始化 Submodule 配置(用于已检出项目,如 CI/CD 中) +git submodule update --init --recursive + +# 新检出项目时,使用以下命令初始化 Submodule 配置(不适用于 CI/CD) +git clone --recursive-submodules https://git.colovu.com/docker/hello-world.git + +# 更新 Submodule 对应的 Commit ID(使用新版本的 Submodule 项目提交内容) +git submodule update --remote +git commit -m "update .ci/common" +git push + +# 切换使用的子模块分支 +git submodule set-branch --branch main .ci/common +git submodule set-branch --branch stable .ci/common +```