v0.1.36 #34
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Public Build | |
on: | |
release: | |
types: [ published ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23.4' | |
- name: Create public branch | |
run: | | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email '[email protected]' | |
git checkout -b public || git checkout public | |
git merge ${{ github.ref_name }} --no-edit || true | |
- name: Remove security package references | |
run: | | |
# 移除 network 包中对 security 的引用 | |
find . -type f -name "*.go" -exec sed -i 's|"github.com/oneclickvirt/security/network"|"github.com/oneclickvirt/basics/network"|g' {} + | |
# 修改 back/network/network.go | |
cat > back/network/network.go << 'EOF' | |
package network1 | |
import "github.com/oneclickvirt/basics/network" | |
func NetworkCheck(checkType string, enableSecurityCheck bool, language string) (string, string, error) { | |
ipInfo, _, err := network.NetworkCheck(checkType, false, language) | |
return ipInfo, "", err | |
} | |
EOF | |
# 修改 utils/utils.go 中的 BasicsAndSecurityCheck 函数 | |
sed -i '/SecurityUploadToken/d' utils/utils.go | |
sed -i 's|"github.com/oneclickvirt/security/network"|"github.com/oneclickvirt/basics/network"|g' utils/utils.go | |
# 在 utils/utils.go 中添加 token 常量(在 import 语句之后) | |
sed -i '/^import/,/^)/{/^)/a\'$'\n''const token = "OvwKx5qgJtf7PZgCKbtyojSU.MTcwMTUxNzY1MTgwMw"'$'\n''}' utils/utils.go | |
# 修改 go.mod,移除私有仓库依赖 | |
sed -i '/github.com\/oneclickvirt\/security/d' go.mod | |
# 修改 goecs.go,禁用 security 检测 | |
sed -i 's|var securityFlag = flag.Bool("security", true,|var securityFlag = flag.Bool("security", false,|g' goecs.go | |
# 更新依赖 | |
go mod tidy | |
# 修改 README.md 和 README_EN.md 中的敏感信息 | |
sed -i 's|但二进制文件编译至 \[securityCheck\].*)|但已开源|g' README.md | |
sed -i 's|but binary files compiled in \[securityCheck\].*)|but open sourced|g' README_EN.md | |
# 修改命令行帮助信息 | |
sed -i 's|security.*Enable/Disable security test (default true)|security Enable/Disable security test (default false)|g' README.md | |
sed -i 's|security.*Enable/Disable security test (default true)|security Enable/Disable security test (default false)|g' README_EN.md | |
- name: Build and Test | |
run: | | |
# 构建二进制文件 | |
go build -o maintest | |
# 测试无菜单模式是否正常运行(禁用 security 检测) | |
./maintest -menu=false -l en -security=false -upload=false || exit 1 | |
rm -rf maintest | |
- name: Commit and push changes | |
run: | | |
git add . | |
git commit -m "Auto update public version (no security package)" || echo "No changes to commit" | |
git push -f origin public |