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