add:添加一个自动生成脚本。
This commit is contained in:
parent
f169d19238
commit
5aac360f9c
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
downloads
|
downloads
|
||||||
*.exe
|
*.exe
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
build
|
44
build.bat
Normal file
44
build.bat
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
@echo off
|
||||||
|
REM 设置Go程序的文件名和输出目录
|
||||||
|
set SOURCE_FILE=main.go
|
||||||
|
set OUTPUT_DIR=build
|
||||||
|
|
||||||
|
REM 定义版本号
|
||||||
|
set VERSION=v1.0
|
||||||
|
|
||||||
|
REM 检查是否存在输出目录,如果不存在则创建
|
||||||
|
if not exist %OUTPUT_DIR% (
|
||||||
|
mkdir %OUTPUT_DIR%
|
||||||
|
)
|
||||||
|
|
||||||
|
REM 构建 32 位 Windows 版本
|
||||||
|
echo Building 32-bit Windows version...
|
||||||
|
set GOOS=windows
|
||||||
|
set GOARCH=386
|
||||||
|
go build -o %OUTPUT_DIR%\tooldown_%VERSION%.win.x86.exe %SOURCE_FILE%
|
||||||
|
if %ERRORLEVEL% neq 0 (
|
||||||
|
echo Failed to build 32-bit Windows version.
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
REM 构建 64 位 Windows 版本
|
||||||
|
echo Building 64-bit Windows version...
|
||||||
|
set GOARCH=amd64
|
||||||
|
go build -o %OUTPUT_DIR%\tooldown_%VERSION%.win.x64.exe %SOURCE_FILE%
|
||||||
|
if %ERRORLEVEL% neq 0 (
|
||||||
|
echo Failed to build 64-bit Windows version.
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
REM 构建 64 位 Linux 版本
|
||||||
|
echo Building 64-bit Linux version...
|
||||||
|
set GOOS=linux
|
||||||
|
set GOARCH=amd64
|
||||||
|
go build -o %OUTPUT_DIR%\tooldown_%VERSION%.linux.x64 %SOURCE_FILE%
|
||||||
|
if %ERRORLEVEL% neq 0 (
|
||||||
|
echo Failed to build 64-bit Linux version.
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
echo All builds completed successfully!
|
||||||
|
exit /b 0
|
5
main.go
5
main.go
@ -7,6 +7,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@ -32,6 +33,10 @@ type Asset struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
|
fmt.Printf("GOARCH: %s\n", runtime.GOARCH)
|
||||||
|
fmt.Printf("GOOS: %s\n", runtime.GOOS)
|
||||||
|
|
||||||
// 选择仓库
|
// 选择仓库
|
||||||
repo := chooseRepository(repositories)
|
repo := chooseRepository(repositories)
|
||||||
apiURL := convertToAPIURL(repo)
|
apiURL := convertToAPIURL(repo)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user