-
Notifications
You must be signed in to change notification settings - Fork 19
111 lines (93 loc) · 3.26 KB
/
release.yml
File metadata and controls
111 lines (93 loc) · 3.26 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:
workflow_dispatch: # Manual trigger via GitHub Actions UI
permissions:
contents: write # Required for pushing commits, tags, and creating releases
id-token: write # Required for PyPI OIDC (Trusted Publishing)
jobs:
bump-version:
name: Bump Version & Create Release
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.cz.outputs.version }}
steps:
- name: Generate GitHub App Token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.OSS_CI_BOT_APP_ID }}
private-key: ${{ secrets.OSS_CI_BOT_PRIVATE_KEY }}
repositories: ${{ github.event.repository.name }}
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0 # Full history required for Commitizen
token: ${{ steps.app-token.outputs.token }}
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: Install Commitizen
run: pip install commitizen
- name: Bump version
id: cz
uses: commitizen-tools/commitizen-action@master
with:
github_token: ${{ steps.app-token.outputs.token }}
changelog_increment_filename: body.md
- name: Print version info
run: |
echo "New version: ${{ steps.cz.outputs.version }}"
echo "Version bump: ${{ steps.cz.outputs.version }}"
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "${{ steps.cz.outputs.version }}" \
--title "Release ${{ steps.cz.outputs.version }}" \
--notes-file "body.md"
build-and-publish:
name: Build and Publish to PyPI
needs: bump-version
runs-on: ubuntu-latest
permissions:
id-token: write # Required for PyPI OIDC
steps:
- name: Checkout code (with new version)
uses: actions/checkout@v6
with:
ref: main # Get the version-bumped code
- name: Setup UV
uses: astral-sh/setup-uv@v7
with:
version: "latest"
enable-cache: true
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: Build package
run: |
uv build --wheel --sdist
ls -lh dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
# No credentials needed - uses OIDC/Trusted Publishing!
test-installation:
name: Test PyPI Installation
needs: [bump-version, build-and-publish]
runs-on: ubuntu-latest
steps:
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: Wait for package availability
run: sleep 60 # Wait for PyPI to index the package
- name: Test installation from PyPI
run: |
pip install opentelemetry-mcp==${{ needs.bump-version.outputs.new_version }}
python -c "import opentelemetry_mcp; print(f'Installed version: {opentelemetry_mcp.__version__}')"
opentelemetry-mcp --help
- name: Installation successful
run: echo "✅ Package successfully published and verified on PyPI!"