From f9f65078f3ffa889face7550ff59220a321e9d8b Mon Sep 17 00:00:00 2001 From: AnotiaWang Date: Wed, 28 Feb 2024 19:17:58 +0800 Subject: [PATCH] chore: add build script --- .gitignore | 1 + build.sh | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100755 build.sh diff --git a/.gitignore b/.gitignore index ba2906d..b7062d9 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ main +build/ \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..31ac7b5 --- /dev/null +++ b/build.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# 定义输出目录 +OUTPUT_DIR="build" +mkdir -p ${OUTPUT_DIR} + +# Linux amd64 +echo "Building for Linux amd64..." +GOOS=linux GOARCH=amd64 go build -o ${OUTPUT_DIR}/gh-proxy-go-linux-amd64 main.go +echo "Output: ${OUTPUT_DIR}/gh-proxy-go-linux-amd64" + +# Linux arm64 +echo "Building for Linux arm64..." +GOOS=linux GOARCH=arm64 go build -o ${OUTPUT_DIR}/gh-proxy-go-linux-arm64 main.go +echo "Output: ${OUTPUT_DIR}/gh-proxy-go-linux-arm64" + +# Linux ARMv7 +echo "Building for Linux ARMv7..." +GOOS=linux GOARCH=arm GOARM=7 go build -o ${OUTPUT_DIR}/gh-proxy-go-linux-armv7 main.go +echo "Output: ${OUTPUT_DIR}/gh-proxy-go-linux-armv7" + +# Windows amd64 +echo "Building for Windows amd64..." +GOOS=windows GOARCH=amd64 go build -o ${OUTPUT_DIR}/gh-proxy-go-windows-amd64.exe main.go +echo "Output: ${OUTPUT_DIR}/gh-proxy-go-windows-amd64.exe" + +# macOS amd64 +echo "Building for macOS amd64..." +GOOS=darwin GOARCH=amd64 go build -o ${OUTPUT_DIR}/gh-proxy-go-macos-amd64 main.go +echo "Output: ${OUTPUT_DIR}/gh-proxy-go-macos-amd64" + +# macOS arm64 +echo "Building for macOS arm64..." +GOOS=darwin GOARCH=arm64 go build -o ${OUTPUT_DIR}/gh-proxy-go-macos-arm64 main.go +echo "Output: ${OUTPUT_DIR}/gh-proxy-go-macos-arm64" + +echo "Build completed."