-
Notifications
You must be signed in to change notification settings - Fork 9
feat(release): Add configuration for Commitizen and GitHub Actions for release #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
3db64d8
feat(release): Add configuration for Commitizen and GitHub Actions fo…
doronkopit5 77b3ab8
Merge branch 'main' into dk/release-pipeline
doronkopit5 2e84b76
fix
doronkopit5 92ffb72
Merge branch 'dk/release-pipeline' of github.com:traceloop/openteleme…
doronkopit5 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| [tool.commitizen] | ||
| name = "cz_conventional_commits" | ||
| version = "0.1.0" | ||
| tag_format = "v$version" | ||
| update_changelog_on_bump = true | ||
| major_version_zero = true | ||
| version_scheme = "pep440" | ||
|
|
||
| # Files where Commitizen will update the version | ||
| version_files = [ | ||
| "pyproject.toml:version", | ||
| "src/opentelemetry_mcp/__init__.py:__version__" | ||
| ] | ||
|
|
||
| # Changelog configuration | ||
| [tool.commitizen.changelog] | ||
| # Categorize commits by type | ||
| file = "CHANGELOG.md" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| 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: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 # Full history required for Commitizen | ||
| token: ${{ secrets.GH_ACCESS_TOKEN }} # Use PAT for pushing | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| - name: Install Commitizen | ||
| run: pip install commitizen | ||
|
|
||
| - name: Bump version | ||
| id: cz | ||
| uses: commitizen-tools/commitizen-action@master | ||
| with: | ||
| github_token: ${{ secrets.GH_ACCESS_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: | ||
| GITHUB_TOKEN: ${{ secrets.GH_ACCESS_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@v4 | ||
| with: | ||
| ref: main # Get the version-bumped code | ||
|
|
||
| - name: Setup UV | ||
| uses: astral-sh/setup-uv@v3 | ||
| with: | ||
| version: "latest" | ||
| enable-cache: true | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| - 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@v5 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| - 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!" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pin the commitizen action version instead of using @master to avoid unexpected changes.