From 08fa6ef9763cfd1815eee261ed15863e4fffd9fe Mon Sep 17 00:00:00 2001 From: SugarMGP <2350745751@qq.com> Date: Thu, 5 Dec 2024 20:39:55 +0800 Subject: [PATCH] Create build.yml --- .github/workflows/build.yml | 35 +++++++++++++++++++++++++++++++++++ makefile | 30 ------------------------------ 2 files changed, 35 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 makefile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..20bb505 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,35 @@ +name: Build + +on: + push: + pull_request: + branches: + - dev + +jobs: + lint: + 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 build -v -o 4u-online . + + - name: Archive Output + run: | + mkdir -p artifacts + mv 4u-online 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 deleted file mode 100644 index 24878be..0000000 --- a/makefile +++ /dev/null @@ -1,30 +0,0 @@ -# 设置环境变量 -CGO_ENABLED=0 -GOOS=linux -GOARCH=amd64 - -# Go 文件 -TARGET=main - -# 默认目标 -all: build - -# 构建目标 -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..." - rm -f $(TARGET) - -# 运行程序 -run: build - @echo "Running $(TARGET)..." - ./$(TARGET)