name: Release on: push: tags: - "v*" permissions: contents: write packages: write id-token: write env: GO_VERSION: "1.25" NODE_VERSION: "20" jobs: build: name: Build ${{ matrix.goos }}/${{ matrix.goarch }} runs-on: ubuntu-latest strategy: matrix: include: - goos: linux goarch: amd64 suffix: "" - goos: linux goarch: arm64 suffix: "" - goos: darwin goarch: amd64 suffix: "" - goos: darwin goarch: arm64 suffix: "" steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} cache: npm cache-dependency-path: web/package-lock.json - name: Build web frontend run: | cd web && npm install --legacy-peer-deps && npm run build - name: Copy web assets run: | rm -rf internal/web/dist cp -r web/build internal/web/dist - name: Extract version from tag id: version run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" - name: Build binary env: CGO_ENABLED: "0" GOOS: ${{ matrix.goos }} GOARCH: ${{ matrix.goarch }} run: | go build \ -ldflags "-s -w -X main.version=${{ steps.version.outputs.VERSION }}" \ -o "synapbus${{ matrix.suffix }}" \ ./cmd/synapbus/ - name: Create archive run: | ARCHIVE_NAME="synapbus-${{ matrix.goos }}-${{ matrix.goarch }}" tar czf "${ARCHIVE_NAME}.tar.gz" synapbus - uses: actions/upload-artifact@v4 with: name: synapbus-${{ matrix.goos }}-${{ matrix.goarch }} path: synapbus-*.tar.gz homebrew: name: Generate Homebrew Formula needs: build runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 with: path: artifacts merge-multiple: true - name: Extract version from tag id: version run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" - name: Calculate checksums and generate formula run: | DARWIN_AMD64_SHA=$(sha256sum artifacts/synapbus-darwin-amd64.tar.gz | awk '{print $1}') DARWIN_ARM64_SHA=$(sha256sum artifacts/synapbus-darwin-arm64.tar.gz | awk '{print $1}') LINUX_AMD64_SHA=$(sha256sum artifacts/synapbus-linux-amd64.tar.gz | awk '{print $1}') LINUX_ARM64_SHA=$(sha256sum artifacts/synapbus-linux-arm64.tar.gz | awk '{print $1}') VERSION="${{ steps.version.outputs.VERSION }}" REPO="https://github.com/${{ github.repository }}" cat > synapbus.rb <> "$GITHUB_OUTPUT" - uses: docker/setup-qemu-action@v3 - uses: docker/setup-buildx-action@v3 - uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Docker metadata id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/synapbus/synapbus tags: | type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=raw,value=latest - uses: docker/build-push-action@v6 with: context: . push: true platforms: linux/amd64,linux/arm64 build-args: | VERSION=${{ steps.version.outputs.VERSION }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max mcp-registry: name: Publish to MCP Registry needs: release runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Extract version from tag id: version run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" - name: Install mcp-publisher run: | curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_linux_amd64.tar.gz" | tar xz mcp-publisher - name: Authenticate to MCP Registry run: ./mcp-publisher login github-oidc - name: Update version in server.json run: | jq --arg v "${{ steps.version.outputs.VERSION }}" '.version = $v' server.json > server.tmp && mv server.tmp server.json - name: Publish to MCP Registry run: ./mcp-publisher publish