From 7f360053507e11d7f631dd20f9b8252f1c4abcff Mon Sep 17 00:00:00 2001 From: SugarMGP <2350745751@qq.com> Date: Thu, 5 Dec 2024 20:39:55 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E6=96=B0=E5=A2=9E=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 34 ++++++++++++++++++++++++++++++++++ makefile | 12 +----------- 2 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7868e54 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,34 @@ +name: Build + +on: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: 1.22 + + - name: Build + run: | + go install src.techknowlogick.com/xgo@latest + xgo -out 4uonline --targets=*/amd64 . + + - name: Archive Output + run: | + mkdir -p artifacts + mv 4uonline* artifacts/ + cp README.md artifacts/ + cp config.example.yaml artifacts/config.yaml + + - name: Upload Artifacts + uses: actions/upload-artifact@v4 + with: + name: build-output + path: artifacts/ diff --git a/makefile b/makefile index 24878be..727347c 100644 --- a/makefile +++ b/makefile @@ -1,8 +1,3 @@ -# 设置环境变量 -CGO_ENABLED=0 -GOOS=linux -GOARCH=amd64 - # Go 文件 TARGET=main @@ -14,11 +9,6 @@ build: @echo "Building $(TARGET)..." go build -o $(TARGET) $(TARGET).go -# 编译为 Linux 目标 -build-linux: - @echo "Building $(TARGET) for $(GOOS)/$(GOARCH)..." - GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=$(CGO_ENABLED) go build -o $(TARGET) $(TARGET).go - # 清理生成的文件 clean: @echo "Cleaning up..." @@ -27,4 +17,4 @@ clean: # 运行程序 run: build @echo "Running $(TARGET)..." - ./$(TARGET) + ./$(TARGET) \ No newline at end of file