-
Notifications
You must be signed in to change notification settings - Fork 7
141 lines (117 loc) · 4.3 KB
/
release.yml
File metadata and controls
141 lines (117 loc) · 4.3 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Release
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
jobs:
test:
uses: ./.github/workflows/test.yml
build_package:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.14'
- name: Install uv
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
- name: Check tag matches version files
run: |
TAG_VERSION="${GITHUB_REF##*/}"
TAG_VERSION_NO_PREFIX="${TAG_VERSION#v}"
echo "Tag version: $TAG_VERSION (stripped: $TAG_VERSION_NO_PREFIX)"
PYPROJECT_VERSION=$(grep '^version =' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
echo "pyproject.toml version: $PYPROJECT_VERSION"
INIT_VERSION=$(grep '^__version__ =' src/pythonanywhere_mcp_server/__init__.py | sed 's/__version__ = "\(.*\)"/\1/')
echo "__init__.py version: $INIT_VERSION"
if [ "$TAG_VERSION_NO_PREFIX" != "$PYPROJECT_VERSION" ]; then
echo "Tag version ($TAG_VERSION_NO_PREFIX) does not match pyproject.toml version ($PYPROJECT_VERSION)" >&2
exit 1
fi
if [ "$TAG_VERSION_NO_PREFIX" != "$INIT_VERSION" ]; then
echo "Tag version ($TAG_VERSION_NO_PREFIX) does not match __init__.py version ($INIT_VERSION)" >&2
exit 1
fi
if [ "$PYPROJECT_VERSION" != "$INIT_VERSION" ]; then
echo "pyproject.toml version ($PYPROJECT_VERSION) does not match __init__.py version ($INIT_VERSION)" >&2
exit 1
fi
shell: bash
- name: Build package
run: uv build
- name: Upload Python artifacts
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: python-dist
path: dist/
build_bundle:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: '24'
- name: Check tag matches manifest.json version
run: |
TAG_VERSION="${GITHUB_REF##*/}"
TAG_VERSION_NO_PREFIX="${TAG_VERSION#v}"
echo "Tag version: $TAG_VERSION (stripped: $TAG_VERSION_NO_PREFIX)"
MANIFEST_VERSION=$(jq -r .version manifest.json)
echo "manifest.json version: $MANIFEST_VERSION"
if [ "$TAG_VERSION_NO_PREFIX" != "$MANIFEST_VERSION" ]; then
echo "Tag version ($TAG_VERSION_NO_PREFIX) does not match manifest.json version ($MANIFEST_VERSION)" >&2
exit 1
fi
shell: bash
- name: Install MCPB toolchain
run: npm install -g @anthropic-ai/mcpb
- name: Pack extension
run: mcpb pack
- name: Upload MCPB artifacts
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: mcpb-dist
path: '*.mcpb'
publish_pypi:
runs-on: ubuntu-latest
needs: [build_package, build_bundle]
steps:
- name: Download Python artifacts
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
with:
name: python-dist
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
create_release:
runs-on: ubuntu-latest
needs: publish_pypi
steps:
- name: Download Python artifacts
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
with:
name: python-dist
path: dist/
- name: Download MCPB artifacts
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
with:
name: mcpb-dist
path: ./
- name: Create Release
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
with:
files: |
*.mcpb
dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}