diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..b3f68f0 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,66 @@ +# This workflow runs on Gitea Actions, which is API-compatible with GitHub Actions. +# It performs CI on every push to main and every pull request, and automatically +# builds and attaches a Linux amd64 release binary when a version tag (v*) is pushed. +name: CI / Release + +on: + push: + branches: + - main + tags: + - 'v*' + pull_request: + +jobs: + ci: + name: CI + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + - name: Build + run: go build ./... + + - name: Vet + run: go vet ./... + + - name: Test + run: go test ./... + + - name: Check formatting + run: | + if [ -n "$(gofmt -l .)" ]; then + gofmt -l . + exit 1 + fi + + release: + name: Release + needs: ci + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + - name: Build release binary + run: GOOS=linux GOARCH=amd64 go build -o spark-mcp-linux-amd64 ./main.go + + - name: Upload release asset + uses: softprops/action-gh-release@v2 + with: + files: spark-mcp-linux-amd64 + generate_release_notes: true