返回 last30days-skill
release.yml
根目录 / .github / workflows / release.yml
1 name: Release
2
3 on:
4 push:
5 tags:
6 - "v*"
7 # tag-release.yml dispatches this because GITHUB_TOKEN tag pushes do not
8 # start other workflows.
9 workflow_dispatch:
10 inputs:
11 tag:
12 description: Tag to release (e.g. v3.18.2)
13 required: true
14 type: string
15
16 permissions: {}
17
18 env:
19 # Tag push uses ref_name (vX.Y.Z); dispatch from tag-release passes inputs.tag.
20 RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
21
22 jobs:
23 # Build the existing .skill artifact (Claude Code / Codex / Cursor install
24 # surface). Unchanged from prior versions; just isolated into its own job
25 # so the .mcpb matrix can run in parallel.
26 build-skill:
27 runs-on: ubuntu-latest
28 permissions:
29 contents: read
30 id-token: write
31 attestations: write
32 steps:
33 - name: Checkout
34 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
35 with:
36 ref: ${{ env.RELEASE_TAG }}
37 fetch-depth: 0
38 persist-credentials: false
39
40 - name: Build .skill artifact
41 run: |
42 bash skills/last30days/scripts/build-skill.sh
43 test -f dist/last30days.skill
44
45 - name: Attest .skill artifact provenance
46 uses: actions/attest@f7c74d28b9d84cb8768d0b8ca14a4bac6ef463e6 # v4.2.0
47 with:
48 subject-path: dist/last30days.skill
49
50 - name: Upload skill artifact
51 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
52 with:
53 name: last30days-skill
54 path: dist/last30days.skill
55
56 # Cross-compile the Go MCP server for each Claude Desktop platform and
57 # package each as a .mcpb. MCPB v0.3 is a ZIP containing the checked-in
58 # manifest and the pre-built binary at the manifest's entry point.
59 build-mcpb:
60 runs-on: ubuntu-latest
61 permissions:
62 contents: read
63 id-token: write
64 attestations: write
65 env:
66 MCPB_OUTPUT: mcp/build/last30days-pp-mcp-${{ matrix.goos }}-${{ matrix.goarch }}.mcpb
67 strategy:
68 fail-fast: false
69 matrix:
70 include:
71 - goos: darwin
72 goarch: arm64
73 - goos: darwin
74 goarch: amd64
75 - goos: linux
76 goarch: amd64
77 steps:
78 - name: Checkout
79 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
80 with:
81 ref: ${{ env.RELEASE_TAG }}
82 persist-credentials: false
83
84 - name: Set up Go
85 uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
86 with:
87 # Build the MCP binary with a toolchain newer than the floor in
88 # mcp/go.mod. Keeping this explicit also avoids a runtime toolchain
89 # download during the cross-compile.
90 go-version: "1.26"
91 cache: false
92
93 - name: Sync engine into vendored/
94 run: bash mcp/scripts/sync-engine.sh
95
96 - name: Build MCP binary
97 env:
98 GOOS: ${{ matrix.goos }}
99 GOARCH: ${{ matrix.goarch }}
100 CGO_ENABLED: "0"
101 RELEASE_VERSION: ${{ env.RELEASE_TAG }}
102 run: |
103 mkdir -p mcp/build
104 go -C mcp build \
105 -ldflags "-X main.Version=${RELEASE_VERSION}" \
106 -o build/last30days-pp-mcp \
107 ./cmd/last30days-pp-mcp
108
109 - name: Bundle .mcpb
110 # Keep this equivalent to printing-press's bundle layout without
111 # downloading a separate packager: manifest.json at the ZIP root and
112 # the executable at its declared server.entry_point.
113 run: |
114 set -euo pipefail
115 entry_point="$(jq -er '.server.entry_point' mcp/manifest.json)"
116 test "${entry_point}" = "bin/last30days-pp-mcp"
117
118 staging="${RUNNER_TEMP}/last30days-mcpb"
119 output="${GITHUB_WORKSPACE}/${MCPB_OUTPUT}"
120 mkdir -p "${staging}/bin" "$(dirname "${output}")"
121 cp mcp/manifest.json "${staging}/manifest.json"
122 cp mcp/build/last30days-pp-mcp "${staging}/${entry_point}"
123 chmod 0755 "${staging}/${entry_point}"
124
125 (
126 cd "${staging}"
127 zip -q -X "${output}" manifest.json "${entry_point}"
128 )
129 unzip -Z1 "${output}" | grep -Fxq "manifest.json"
130 unzip -Z1 "${output}" | grep -Fxq "${entry_point}"
131
132 - name: Attest .mcpb artifact provenance
133 uses: actions/attest@f7c74d28b9d84cb8768d0b8ca14a4bac6ef463e6 # v4.2.0
134 with:
135 subject-path: ${{ env.MCPB_OUTPUT }}
136
137 - name: Upload .mcpb artifact
138 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
139 with:
140 name: mcpb-${{ matrix.goos }}-${{ matrix.goarch }}
141 path: ${{ env.MCPB_OUTPUT }}
142
143 # Gather every platform artifact and attach to one GitHub release.
144 release:
145 needs: [build-skill, build-mcpb]
146 runs-on: ubuntu-latest
147 permissions:
148 actions: read
149 contents: write
150 steps:
151 # gh release create --verify-tag shells out to git, so the job needs a
152 # checkout with the tag present; without it the step fails with
153 # "fatal: not a git repository".
154 - name: Checkout
155 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
156 with:
157 ref: ${{ env.RELEASE_TAG }}
158 fetch-depth: 0
159 persist-credentials: false
160
161 - name: Download all artifacts
162 uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
163 with:
164 path: dist
165 merge-multiple: true
166
167 - name: Create GitHub release
168 env:
169 GH_TOKEN: ${{ github.token }}
170 RELEASE_TAG: ${{ env.RELEASE_TAG }}
171 run: |
172 gh release create "${RELEASE_TAG}" \
173 dist/last30days.skill \
174 dist/last30days-pp-mcp-*.mcpb \
175 --generate-notes \
176 --verify-tag
177
177 lines YAML