Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# Build settings
build --enable_bzlmod
build --workspace_status_command=build/status.sh

# Test settings
test --test_output=errors
Expand Down Expand Up @@ -31,3 +32,6 @@ build:windows_amd64 --@rules_go//go/config:static=false
build:ci --noshow_progress
build:ci --noshow_loading_progress
test:ci --test_output=all

# Release configuration: enable workspace stamping for version injection
build:release --stamp
70 changes: 49 additions & 21 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@ name: Release

on:
push:
tags:
- "v*"
branches: [main]

permissions:
contents: write
pull-requests: write

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Setup Bazel
uses: bazel-contrib/setup-bazel@0.18.0
Expand All @@ -27,10 +25,42 @@ jobs:
- name: Run tests
run: bazel test //... --config=ci

release:
name: Release
build:
name: Build
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v6

- name: Setup Bazel
uses: bazel-contrib/setup-bazel@0.18.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}
repository-cache: true

- name: Build
run: bazel build //cmd/zuul-mcp --config=ci

release-please:
name: Release Please
runs-on: ubuntu-latest
needs: [build]
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
config-file: .release-please-config.json
manifest-file: .release-please-manifest.json

publish:
name: Publish Binaries
runs-on: ubuntu-latest
needs: [release-please]
if: needs.release-please.outputs.release_created == 'true'
steps:
- uses: actions/checkout@v6
with:
Expand All @@ -46,37 +76,35 @@ jobs:
- name: Build binaries
run: |
mkdir -p dist

# Linux amd64 (static binary)
bazel build //cmd/zuul-mcp --config=linux_amd64 --config=ci
bazel build //cmd/zuul-mcp --config=linux_amd64 --config=ci --config=release
cp bazel-bin/cmd/zuul-mcp/zuul-mcp_/zuul-mcp dist/zuul-mcp-linux-amd64

# Linux arm64 (static binary)
bazel build //cmd/zuul-mcp --config=linux_arm64 --config=ci
bazel build //cmd/zuul-mcp --config=linux_arm64 --config=ci --config=release
cp bazel-bin/cmd/zuul-mcp/zuul-mcp_/zuul-mcp dist/zuul-mcp-linux-arm64

# macOS amd64
bazel build //cmd/zuul-mcp --config=darwin_amd64 --config=ci
bazel build //cmd/zuul-mcp --config=darwin_amd64 --config=ci --config=release
cp bazel-bin/cmd/zuul-mcp/zuul-mcp_/zuul-mcp dist/zuul-mcp-darwin-amd64

# macOS arm64 (Apple Silicon)
bazel build //cmd/zuul-mcp --config=darwin_arm64 --config=ci
bazel build //cmd/zuul-mcp --config=darwin_arm64 --config=ci --config=release
cp bazel-bin/cmd/zuul-mcp/zuul-mcp_/zuul-mcp dist/zuul-mcp-darwin-arm64

# Windows amd64
bazel build //cmd/zuul-mcp --config=windows_amd64 --config=ci
bazel build //cmd/zuul-mcp --config=windows_amd64 --config=ci --config=release
cp bazel-bin/cmd/zuul-mcp/zuul-mcp_/zuul-mcp.exe dist/zuul-mcp-windows-amd64.exe

# Create checksums
cd dist
sha256sum * > checksums.txt

- name: Create Release
- name: Upload binaries to release
uses: softprops/action-gh-release@v2
with:
draft: false
prerelease: false
generate_release_notes: true
tag_name: ${{ needs.release-please.outputs.tag_name }}
files: |
dist/zuul-mcp-linux-amd64
dist/zuul-mcp-linux-arm64
Expand Down
18 changes: 14 additions & 4 deletions .github/workflows/ci.yaml → .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
name: CI
name: Test

on:
push:
branches: [main]
pull_request:
branches: [main]

concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true

jobs:
pr-title:
name: PR Title (Conventional Commits)
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

test:
name: Test
runs-on: ubuntu-latest
Expand Down
15 changes: 15 additions & 0 deletions .release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"packages": {
".": {
"release-type": "simple",
"changelog-path": "CHANGELOG.md",
"extra-files": [
{
"type": "generic",
"path": "MODULE.bazel",
"search": "version = \"[0-9]+\\.[0-9]+\\.[0-9]+\""
}
]
}
}
}
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.1.0"
}
7 changes: 7 additions & 0 deletions build/status.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
# Workspace status script for Bazel stamping.
# Outputs stable keys used by x_defs in go_binary rules.

echo "STABLE_GIT_TAG $(git describe --tags --always --dirty 2>/dev/null || echo 'dev')"
echo "STABLE_GIT_COMMIT $(git rev-parse --short HEAD 2>/dev/null || echo 'unknown')"
echo "BUILD_DATE $(date -u +%Y-%m-%dT%H:%M:%SZ)"
5 changes: 5 additions & 0 deletions cmd/zuul-mcp/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@ go_binary(
name = "zuul-mcp",
embed = [":zuul-mcp_lib"],
visibility = ["//visibility:public"],
x_defs = {
"main.version": "{STABLE_GIT_TAG}",
"main.commit": "{STABLE_GIT_COMMIT}",
"main.date": "{BUILD_DATE}",
},
)
Loading