Skip to content

Commit

Permalink
chore: add build script
Browse files Browse the repository at this point in the history
  • Loading branch information
AnotiaWang committed Feb 28, 2024
1 parent 90c103c commit f9f6507
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
main
build/
37 changes: 37 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -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."

0 comments on commit f9f6507

Please sign in to comment.