Repository navigation
111 lines (88 loc) · 3.86 KB
/
Copy pathrelease.yml
File metadata and controls
111 lines (88 loc) · 3.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write # gh release create
id-token: write # PyPI trusted publishing (OIDC)
jobs:
release:
name: Publish PyPI package and MCPB bundle
runs-on: ubuntu-latest
environment: pypi
steps:
- name: Checkout repository
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
# The release step passes GH_TOKEN explicitly; leaving the
# checkout credentials on disk only widens this privileged job.
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.12'
- name: Set up uv
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
with:
# Without this the action defaults to "latest", so the uv that
# builds and publishes would float — pinning the action SHA but
# not the tool it installs would only look reproducible.
version: '0.12.3'
checksum: '600cf9a742aca00d292673b16b5acffaa7b8c269a364ad0c2e79498dcb1fe101'
# This job publishes to PyPI with id-token: write. Restoring a
# cache another workflow wrote is avoidable input to it, and a
# release that runs a few times a year gains nothing from caching.
enable-cache: false
- name: Set up Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: '22'
# --- Validation: everything that can fail must fail before we publish ---
# Cheapest check first: a version typo should not cost a full test run.
- name: Check tag, pyproject, and manifest agree
run: |
version=$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml","rb"))["project"]["version"])')
manifest_version=$(python -c 'import json; print(json.load(open("manifest.json"))["version"])')
if [ "v${version}" != "${GITHUB_REF_NAME}" ]; then
echo "::error::tag ${GITHUB_REF_NAME} does not match pyproject.toml version ${version}"
exit 1
fi
if [ "${manifest_version}" != "${version}" ]; then
echo "::error::manifest.json version ${manifest_version} does not match pyproject.toml version ${version}"
exit 1
fi
echo "VERSION=${version}" >> "$GITHUB_ENV"
- name: Run tests
run: uv run python -m unittest discover -s tests -p 'test*.py'
- name: Install MCPB CLI
run: npm install -g @anthropic-ai/mcpb@2.1.2
- name: Validate manifest
run: mcpb validate .
# --- Build ---
- name: Build sdist and wheel
run: uv build
- name: Pack MCPB bundle
# Runs after `uv build`; .mcpbignore excludes dist/ so the bundle
# does not swallow the wheel.
run: mcpb pack . "dist/atproto-mcp-${VERSION}.mcpb"
- name: Sign MCPB bundle
run: mcpb sign "dist/atproto-mcp-${VERSION}.mcpb" --self-signed
- name: Report bundle details
# `mcpb verify` is not used as a gate: node-forge does not implement
# PKCS#7 verification, so mcpb 2.1.2 reports every signed bundle as
# unsigned. The signature block itself is written correctly.
run: mcpb info "dist/atproto-mcp-${VERSION}.mcpb"
# --- Publish: irreversible from here ---
- name: Publish to PyPI
run: uv publish --trusted-publishing always dist/*.whl dist/*.tar.gz
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "${GITHUB_REF_NAME}" \
"dist/atproto-mcp-${VERSION}.mcpb" \
dist/*.whl \
dist/*.tar.gz \
--title "${GITHUB_REF_NAME}" \
--generate-notes