Skip to content

Commit 869c8de

Browse files
authored
add GitHub build CI (#30)
Add CI for releasing builds
1 parent a9e4f27 commit 869c8de

File tree

6 files changed

+40
-38
lines changed

6 files changed

+40
-38
lines changed

.github/workflows/release.yaml

+22-33
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ on:
1515
- major
1616
- minor
1717
- patch
18+
- alpha
19+
- beta
20+
- rc
21+
- rev
22+
- post
1823

1924
jobs:
2025

@@ -25,6 +30,7 @@ jobs:
2530
new_tag: ${{ steps.set_var.outputs.new_tag }}
2631
permissions:
2732
contents: write # IMPORTANT: mandatory for making GitHub Releases
33+
id-token: write # IMPORTANT: mandatory for trusted publishing
2834
steps:
2935
- uses: actions/checkout@v4
3036
- name: Set up Python
@@ -35,54 +41,32 @@ jobs:
3541
run: >-
3642
python3 -m
3743
pip install
38-
poetry
44+
hatchling uv
3945
--user
4046
- name: update version tag in pyproject.toml
4147
id: set_var
42-
run: |
43-
poetry version ${{ github.event.inputs.version_bump }}
44-
echo "new_tag=$(poetry version --short)" >> $GITHUB_OUTPUT
48+
run: |
49+
hatchling version ${{ github.event.inputs.version_bump }}
50+
echo "new_tag=$(hatchling version)" >> $GITHUB_OUTPUT
4551
git config --global user.email "[email protected]"
4652
git config --global user.name "github robot"
4753
git commit -am "update package build version gha"
4854
git push origin main
4955
5056
- name: Build a binary wheel and a source tarball
51-
run: poetry build
57+
run: uv build && uv publish
5258
- name: Store the distribution packages
5359
uses: actions/upload-artifact@v3
5460
with:
5561
name: python-package-distributions
5662
path: dist/
57-
publish-to-pypi:
58-
name: >-
59-
Publish Python 🐍 distribution 📦 to PyPI
60-
needs:
61-
- build
62-
runs-on: ubuntu-latest
63-
environment:
64-
name: release
65-
url: https://pypi.org/p/MCP_Bridge # Replace <package-name> with your PyPI project name
66-
permissions:
67-
id-token: write # IMPORTANT: mandatory for trusted publishing
6863

69-
steps:
70-
- name: Download all the dists
71-
uses: actions/download-artifact@v3
72-
with:
73-
name: python-package-distributions
74-
path: dist/
75-
- name: Publish distribution 📦 to PyPI
76-
uses: pypa/gh-action-pypi-publish@release/v1
77-
with:
78-
skip-existing: true
7964

8065
github-release:
8166
name: >-
8267
Sign the Python 🐍 distribution 📦 with Sigstore
8368
and upload them to GitHub Release
8469
needs:
85-
- publish-to-pypi
8670
- build
8771
runs-on: ubuntu-latest
8872

@@ -96,13 +80,13 @@ jobs:
9680
uses: actions/download-artifact@v3
9781
with:
9882
name: python-package-distributions
99-
path: dist/
83+
path: .
10084
- name: Sign the dists with Sigstore
10185
uses: sigstore/[email protected]
10286
with:
10387
inputs: >-
104-
./dist/*.tar.gz
105-
./dist/*.whl
88+
./*.tar.gz
89+
./*.whl
10690
- name: Create GitHub Release
10791
env:
10892
GITHUB_TOKEN: ${{ github.token }}
@@ -111,7 +95,7 @@ jobs:
11195
gh release create
11296
'${{ needs.build.outputs.new_tag }}'
11397
--repo '${{ github.repository }}'
114-
--notes ""
98+
--generate-notes
11599
- name: Upload artifact signatures to GitHub Release
116100
env:
117101
GITHUB_TOKEN: ${{ github.token }}
@@ -120,21 +104,26 @@ jobs:
120104
# sigstore-produced signatures and certificates.
121105
run: >-
122106
gh release upload
123-
'${{ needs.build.outputs.new_tag }}' dist/**
107+
'${{ needs.build.outputs.new_tag }}' ./*.tar.gz ./*.whl ./*.tar.gz.sigstore.json ./*.whl.sigstore.json
124108
--repo '${{ github.repository }}'
125109
126110
push-store-image:
127111
permissions: write-all
128112
runs-on: ubuntu-latest
113+
needs:
114+
- build
129115
steps:
130116
- name: Login to GitHub Container Registry
131117
uses: docker/login-action@v2
132118
with:
133119
registry: ghcr.io
134120
username: ${{ github.actor }}
135121
password: ${{ secrets.GITHUB_TOKEN }}
136-
122+
- name: Checkout code
123+
uses: actions/checkout@v4
137124
- name: 'Build images'
138125
run: |
139126
RELEASE=${{ needs.build.outputs.new_tag }} \
140127
docker buildx bake mcp-bridge -f docker-bake.hcl --push
128+
129+

Dockerfile

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
99
RUN apt-get install -y --no-install-recommends nodejs
1010

1111
COPY pyproject.toml .
12+
13+
## FOR GHCR BUILD PIPELINE
14+
COPY mcp_bridge/__init__.py mcp_bridge/__init__.py
15+
COPY README.md README.md
16+
17+
1218
RUN uv sync
1319

1420
COPY mcp_bridge mcp_bridge

docker-bake.hcl

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ variable "RELEASE" {
44
}
55

66
variable "REGISTRY" {
7-
default = "ghcr.io/secretiveshell/mcp-bridge/"
7+
default = "ghcr.io/secretiveshell/mcp-bridge"
88
}
99

1010
group "default" {
@@ -14,7 +14,7 @@ group "default" {
1414

1515
target "mcp-bridge" {
1616
dockerfile = "Dockerfile"
17-
tags = ["${REGISTRY}${target.mcp-bridge.name}:${RELEASE}"]
17+
tags = ["${REGISTRY}/${target.mcp-bridge.name}:${RELEASE}"]
1818
context = "."
1919
labels = {
2020
"org.opencontainers.image.source" = "https://github.com/SecretiveShell/MCP-Bridge"

mcp_bridge/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = '0.0.0'

pyproject.toml

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "mcp-bridge"
3-
version = "0.1.0"
3+
dynamic = ["version"]
44
description = "A middleware to provide an openAI compatible endpoint that can call MCP tools."
55
readme = "README.md"
66
requires-python = ">=3.11"
@@ -26,3 +26,9 @@ dev = [
2626
"mypy>=1.14.0",
2727
"ruff>=0.8.4",
2828
]
29+
[build-system]
30+
requires = [ "hatchling",]
31+
build-backend = "hatchling.build"
32+
33+
[tool.hatch.version]
34+
path = "mcp_bridge/__init__.py"

uv.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)