-
Notifications
You must be signed in to change notification settings - Fork 4
58 lines (48 loc) · 1.44 KB
/
release.yml
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
name: Release
on:
release:
types: [published]
env:
PYTHON_VERSION: "3.10"
jobs:
publish:
runs-on: ubuntu-latest
permissions:
# Needed for PyPI trusted publishing
id-token: write
# Needed for uploading to GitHub releases
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Build package
run: |
uv venv
source .venv/bin/activate
uv sync --no-dev
uv build
- name: Check version matches tag
run: |
PKG_VERSION=$(uv run python -c "from mcpadapt import __version__; print(__version__)")
TAG_VERSION=${GITHUB_REF#refs/tags/v}
if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then
echo "Version mismatch: Package version ($PKG_VERSION) does not match tag version ($TAG_VERSION)"
exit 1
fi
- name: Upload to GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: softprops/action-gh-release@v1
with:
files: dist/*
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/