From 2c16fa4dc4f901f2949183494b7354dfd9a378d1 Mon Sep 17 00:00:00 2001 From: Admin Date: Mon, 9 Feb 2026 10:11:14 +0100 Subject: [PATCH] Add Gitea Actions workflow for build and release - Build and test on push to main and PRs - Create multi-platform releases on version tags - Supports Linux, macOS, and Windows (amd64 and arm64) Co-authored-by: Cursor --- .gitea/workflows/build.yml | 83 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 .gitea/workflows/build.yml diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..31f4d57 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,83 @@ +name: Build and Release + +on: + push: + branches: + - main + tags: + - 'v*' + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.19' + + - name: Build + run: go build -v ./... + + - name: Test + run: go test -v ./... + + release: + runs-on: ubuntu-latest + needs: build + if: startsWith(github.ref, 'refs/tags/v') + strategy: + matrix: + include: + - os: linux + arch: amd64 + goos: linux + goarch: amd64 + - os: linux + arch: arm64 + goos: linux + goarch: arm64 + - os: darwin + arch: amd64 + goos: darwin + goarch: amd64 + - os: darwin + arch: arm64 + goos: darwin + goarch: arm64 + - os: windows + arch: amd64 + goos: windows + goarch: amd64 + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.19' + + - name: Build binary + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + CGO_ENABLED: 0 + run: | + if [ "${{ matrix.os }}" = "windows" ]; then + go build -o unhttpx-${{ matrix.os }}-${{ matrix.arch }}.exe -ldflags="-s -w" . + else + go build -o unhttpx-${{ matrix.os }}-${{ matrix.arch }} -ldflags="-s -w" . + fi + + - name: Create Release + uses: actions/gitea-release-action@v1 + with: + files: unhttpx-* + token: ${{ secrets.GITHUB_TOKEN }}