Skip to content

Commit 73ce058

Browse files
chore: go releaser (#71)
* add goreleaser and associated workflows
1 parent b2503f3 commit 73ce058

File tree

4 files changed

+93
-4
lines changed

4 files changed

+93
-4
lines changed

.github/workflows/goreleaser.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: GoReleaser Release
2+
on:
3+
push:
4+
tags:
5+
- "v*"
6+
permissions:
7+
contents: write
8+
9+
jobs:
10+
release:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Check out code
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Go
18+
uses: actions/setup-go@v5
19+
with:
20+
go-version-file: "go.mod"
21+
22+
- name: Download dependencies
23+
run: go mod download
24+
25+
- name: Run GoReleaser
26+
uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552
27+
with:
28+
distribution: goreleaser
29+
# GoReleaser version
30+
version: "~> v2"
31+
# Arguments to pass to GoReleaser
32+
args: release --clean
33+
workdir: .
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
.idea
22
cmd/github-mcp-server/github-mcp-server
3+
# Added by goreleaser init:
4+
dist/

.goreleaser.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
version: 2
2+
project_name: github-mcp-server
3+
before:
4+
hooks:
5+
- go mod tidy
6+
- go generate ./...
7+
- script/licenses
8+
- cp -r ./third-party/ ./dist
9+
- cp third-party-licenses.md ./dist/third-party-licenses.md
10+
11+
builds:
12+
- env:
13+
- CGO_ENABLED=0
14+
ldflags:
15+
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
16+
goos:
17+
- linux
18+
- windows
19+
- darwin
20+
main: ./cmd/github-mcp-server
21+
22+
archives:
23+
- formats: tar.gz
24+
# this name template makes the OS and Arch compatible with the results of `uname`.
25+
name_template: >-
26+
{{ .ProjectName }}_
27+
{{- title .Os }}_
28+
{{- if eq .Arch "amd64" }}x86_64
29+
{{- else if eq .Arch "386" }}i386
30+
{{- else }}{{ .Arch }}{{ end }}
31+
{{- if .Arm }}v{{ .Arm }}{{ end }}
32+
# use zip for windows archives
33+
format_overrides:
34+
- goos: windows
35+
formats: zip
36+
37+
changelog:
38+
sort: asc
39+
filters:
40+
exclude:
41+
- "^docs:"
42+
- "^test:"
43+
44+
release:
45+
draft: true
46+
prerelease: auto
47+
name_template: "GitHub MCP Server {{.Version}}"

cmd/github-mcp-server/main.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,16 @@ import (
1919
"github.com/spf13/viper"
2020
)
2121

22+
var version = "version"
23+
var commit = "commit"
24+
var date = "date"
25+
2226
var (
2327
rootCmd = &cobra.Command{
24-
Use: "server",
25-
Short: "GitHub MCP Server",
26-
Long: `A GitHub MCP server that handles various tools and resources.`,
28+
Use: "server",
29+
Short: "GitHub MCP Server",
30+
Long: `A GitHub MCP server that handles various tools and resources.`,
31+
Version: fmt.Sprintf("%s (%s) %s", version, commit, date),
2732
}
2833

2934
stdioCmd = &cobra.Command{
@@ -101,7 +106,7 @@ func runStdioServer(readOnly bool, logger *log.Logger, logCommands bool, exportT
101106
logger.Fatal("GITHUB_PERSONAL_ACCESS_TOKEN not set")
102107
}
103108
ghClient := gogithub.NewClient(nil).WithAuthToken(token)
104-
ghClient.UserAgent = "github-mcp-server/1.0"
109+
ghClient.UserAgent = fmt.Sprintf("github-mcp-server/%s", version)
105110

106111
// Check GH_HOST env var first, then fall back to viper config
107112
host := os.Getenv("GH_HOST")

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy