🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] ## 概述 1.在新建任务中选择 "MultiJob Project" ## 实例 ### go 打包脚本实例 linux <details> <summary>deploy.sh</summary> ``` #!/usr/bash # 如果go 版本比较高,则需要在脚本中添加 GOCACHE 与 GOPATH # 在 安装 jenkins 的服务器中执行 go env 获取真实 的GOCACHE 与 GOPATH #如 export GOCACHE="/root/.cache/go-build" export GOPATH="/root/go/" echo "start build linux transponder" build() { rm -rf ../build/linux/${1}_server/ mkdir -p ../build/linux/${1}_server/bin/ mkdir -p ../build/linux/${1}_server/config/ \cp ../config/${1}.yaml ../build/linux/${1}_server/config/ go build -ldflags "-w -s" -gcflags "all=-N -l" -o ../build/linux/${1}_server/bin/${1}_server ../cmd/${1}_server.go } # 内网包 build inner # 外网 build outer echo "finish build linux transponder" ``` </details> <br/> window <details> <summary>main.go</summary> ``` @echo off echo "start build linux transponder" SET GOOS=windows call:build inner call:build outer echo "finish build linux transponder" goto :EOF :build del /F /S /Q ..\build\windows\%1_server\ md ..\build\windows\%1_server\bin\ md ..\build\windows\%1_server\config\ xcopy/ye ..\config\%1.yaml ..\build\windows\%1_server\config\ go build -ldflags "-w -s" -gcflags "all=-N -l" -o ..\build\windows\%1_server\bin\%1_server.exe ..\cmd\%1_server.go goto:EOF ``` </details> <br/>