Skip to content

Commit 034aab1

Browse files
committed
feat: Modernize release pipeline based on mark3labs/phalcon-mcp
- Update GoReleaser to version 2 format for latest features - Streamline configuration following mark3labs best practices - Add Docker multi-stage build with Alpine base - Include GitHub Container Registry publishing - Add .dockerignore for optimized builds - Simplify archive naming and structure - Add packages write permission for container registry - Use latest Go version checking in CI
1 parent 9655d5c commit 034aab1

File tree

4 files changed

+119
-142
lines changed

4 files changed

+119
-142
lines changed

.dockerignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Git
2+
.git
3+
.gitignore
4+
5+
# Documentation
6+
README.md
7+
example_usage.md
8+
*.md
9+
10+
# Build artifacts
11+
anki-mcp
12+
dist/
13+
14+
# Test files
15+
*_test.go
16+
coverage.out
17+
coverage.txt
18+
19+
# IDE files
20+
.vscode/
21+
.idea/
22+
*.swp
23+
*.swo
24+
25+
# OS files
26+
.DS_Store
27+
Thumbs.db
28+
29+
# GitHub
30+
.github/
31+
32+
# GoReleaser
33+
.goreleaser.yml
34+
35+
# Docker
36+
Dockerfile
37+
.dockerignore
38+
39+
# Makefile
40+
Makefile

.github/workflows/release.yml

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,51 @@ on:
77

88
permissions:
99
contents: write
10+
packages: write
1011

1112
jobs:
1213
goreleaser:
1314
runs-on: ubuntu-latest
14-
1515
steps:
16-
- name: Checkout
17-
uses: actions/checkout@v4
18-
with:
19-
fetch-depth: 0
20-
21-
- name: Set up Go
22-
uses: actions/setup-go@v5
23-
with:
24-
go-version: '1.21'
25-
26-
- name: Run GoReleaser
27-
uses: goreleaser/goreleaser-action@v5
28-
with:
29-
distribution: goreleaser
30-
version: v1.26.2
31-
args: release --clean
32-
env:
33-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v5
23+
with:
24+
go-version: '>=1.21.0'
25+
check-latest: true
26+
27+
- name: Run GoReleaser
28+
uses: goreleaser/goreleaser-action@v5
29+
with:
30+
distribution: goreleaser
31+
version: '2'
32+
args: release --clean
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Extract version
37+
id: get-version
38+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
39+
40+
- name: Login to GitHub Container Registry
41+
uses: docker/login-action@v3
42+
with:
43+
registry: ghcr.io
44+
username: ${{ github.repository_owner }}
45+
password: ${{ secrets.GITHUB_TOKEN }}
46+
47+
- name: Set up Docker Buildx
48+
uses: docker/setup-buildx-action@v3
49+
50+
- name: Build and push Docker image
51+
uses: docker/build-push-action@v5
52+
with:
53+
context: .
54+
push: true
55+
tags: |
56+
ghcr.io/${{ github.repository }}:latest
57+
ghcr.io/${{ github.repository }}:${{ steps.get-version.outputs.VERSION }}

.goreleaser.yml

Lines changed: 19 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
project_name: anki-mcp
1+
version: 2
22

33
before:
44
hooks:
55
- go mod tidy
6-
- go generate ./...
76

87
builds:
9-
- env:
8+
- id: anki-mcp
9+
env:
1010
- CGO_ENABLED=0
1111
goos:
1212
- linux
@@ -15,152 +15,51 @@ builds:
1515
goarch:
1616
- amd64
1717
- arm64
18-
ignore:
19-
- goos: windows
20-
goarch: arm64
21-
binary: anki-mcp
2218
ldflags:
2319
- -s -w
2420
- -X main.version={{.Version}}
2521
- -X main.commit={{.Commit}}
2622
- -X main.date={{.Date}}
23+
binary: anki-mcp
24+
main: .
2725

2826
archives:
29-
- replacements:
30-
darwin: Darwin
31-
linux: Linux
32-
windows: Windows
33-
386: i386
34-
amd64: x86_64
27+
- id: default
3528
format_overrides:
3629
- goos: windows
37-
format: zip
30+
formats:
31+
- zip
32+
name_template: >-
33+
{{ .ProjectName }}_
34+
{{- .Os }}_
35+
{{- .Arch }}
3836
files:
3937
- README.md
40-
- LICENSE
38+
- LICENSE*
4139
- claude_config_example.json
4240
- example_usage.md
4341

4442
checksum:
4543
name_template: 'checksums.txt'
44+
algorithm: sha256
4645

4746
snapshot:
48-
name_template: "{{ incpatch .Version }}-next"
47+
name_template: "{{ .Version }}-SNAPSHOT-{{ .ShortCommit }}"
4948

5049
changelog:
5150
sort: asc
5251
filters:
5352
exclude:
5453
- '^docs:'
5554
- '^test:'
56-
- '^ci:'
57-
- '^chore:'
58-
- '^style:'
59-
- '^refactor:'
55+
- Merge pull request
56+
- Merge branch
6057

6158
release:
6259
github:
6360
owner: ezynda3
6461
name: anki-mcp
6562
draft: false
6663
prerelease: auto
67-
name_template: "{{.ProjectName}} {{.Version}}"
68-
header: |
69-
## Anki MCP Server {{ .Tag }}
70-
71-
A Model Context Protocol (MCP) server for managing Anki flashcards through AnkiConnect.
72-
73-
### Installation
74-
75-
Download the appropriate binary for your platform from the assets below.
76-
77-
### Usage
78-
79-
1. Ensure Anki is running with AnkiConnect addon installed
80-
2. Configure your MCP client (e.g., Claude Desktop) to use the binary
81-
3. Start creating and managing Anki cards through your AI assistant!
82-
83-
See the [README](https://github.com/ezynda3/anki-mcp/blob/main/README.md) for detailed setup instructions.
84-
footer: |
85-
**Full Changelog**: https://github.com/ezynda3/anki-mcp/compare/{{ .PreviousTag }}...{{ .Tag }}
86-
87-
---
88-
89-
### Verification
90-
91-
All binaries are signed and checksums are provided. Verify downloads using:
92-
```bash
93-
sha256sum -c checksums.txt
94-
```
95-
96-
brews:
97-
- tap:
98-
owner: ezynda3
99-
name: homebrew-tap
100-
folder: Formula
101-
homepage: https://github.com/ezynda3/anki-mcp
102-
description: "MCP server for managing Anki flashcards through AnkiConnect"
103-
license: MIT
104-
test: |
105-
system "#{bin}/anki-mcp --version"
106-
install: |
107-
bin.install "anki-mcp"
108-
109-
nfpms:
110-
- id: packages
111-
package_name: anki-mcp
112-
file_name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
113-
vendor: ezynda3
114-
homepage: https://github.com/ezynda3/anki-mcp
115-
maintainer: ezynda3 <[email protected]>
116-
description: MCP server for managing Anki flashcards through AnkiConnect
117-
license: MIT
118-
formats:
119-
- deb
120-
- rpm
121-
- apk
122-
bindir: /usr/bin
123-
contents:
124-
- src: ./README.md
125-
dst: /usr/share/doc/anki-mcp/README.md
126-
- src: ./claude_config_example.json
127-
dst: /usr/share/doc/anki-mcp/claude_config_example.json
128-
- src: ./example_usage.md
129-
dst: /usr/share/doc/anki-mcp/example_usage.md
130-
131-
dockers:
132-
- image_templates:
133-
- "ghcr.io/ezynda3/anki-mcp:{{ .Version }}-amd64"
134-
- "ghcr.io/ezynda3/anki-mcp:latest-amd64"
135-
dockerfile: Dockerfile
136-
build_flag_templates:
137-
- "--pull"
138-
- "--label=org.opencontainers.image.created={{.Date}}"
139-
- "--label=org.opencontainers.image.title={{.ProjectName}}"
140-
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
141-
- "--label=org.opencontainers.image.version={{.Version}}"
142-
- "--label=org.opencontainers.image.source=https://github.com/ezynda3/anki-mcp"
143-
- "--platform=linux/amd64"
144-
- image_templates:
145-
- "ghcr.io/ezynda3/anki-mcp:{{ .Version }}-arm64"
146-
- "ghcr.io/ezynda3/anki-mcp:latest-arm64"
147-
dockerfile: Dockerfile
148-
build_flag_templates:
149-
- "--pull"
150-
- "--label=org.opencontainers.image.created={{.Date}}"
151-
- "--label=org.opencontainers.image.title={{.ProjectName}}"
152-
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
153-
- "--label=org.opencontainers.image.version={{.Version}}"
154-
- "--label=org.opencontainers.image.source=https://github.com/ezynda3/anki-mcp"
155-
- "--platform=linux/arm64"
156-
goarch: arm64
157-
158-
docker_manifests:
159-
- name_template: "ghcr.io/ezynda3/anki-mcp:{{ .Version }}"
160-
image_templates:
161-
- "ghcr.io/ezynda3/anki-mcp:{{ .Version }}-amd64"
162-
- "ghcr.io/ezynda3/anki-mcp:{{ .Version }}-arm64"
163-
- name_template: "ghcr.io/ezynda3/anki-mcp:latest"
164-
image_templates:
165-
- "ghcr.io/ezynda3/anki-mcp:latest-amd64"
166-
- "ghcr.io/ezynda3/anki-mcp:latest-arm64"
64+
name_template: "{{ .Tag }}"
65+
mode: replace

Dockerfile

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
1-
FROM scratch
1+
# Build stage
2+
FROM golang:1.21-alpine AS builder
23

3-
COPY anki-mcp /anki-mcp
4+
WORKDIR /app
5+
COPY go.mod go.sum ./
6+
RUN go mod download
47

5-
ENTRYPOINT ["/anki-mcp"]
8+
COPY . .
9+
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o anki-mcp .
10+
11+
# Final stage
12+
FROM alpine:latest
13+
14+
RUN apk --no-cache add ca-certificates
15+
WORKDIR /root/
16+
17+
COPY --from=builder /app/anki-mcp .
18+
19+
ENTRYPOINT ["./anki-mcp"]

0 commit comments

Comments
 (0)