Skip to content

Commit f062687

Browse files
committed
ci: switch release flow to tag-triggered and add PR title checks
Signed-off-by: Arshdeep54 <balarsh535@gmail.com>
1 parent d24e902 commit f062687

4 files changed

Lines changed: 198 additions & 0 deletions

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Publish Python Client
2+
3+
on:
4+
push:
5+
tags:
6+
- "python-v*.*.*"
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: "Tag to publish (e.g. python-v0.2.0) — must already exist"
11+
required: true
12+
13+
defaults:
14+
run:
15+
working-directory: client/python
16+
17+
jobs:
18+
publish:
19+
name: Build and Publish to PyPI
20+
runs-on: ubuntu-latest
21+
environment: pypi
22+
permissions:
23+
id-token: write
24+
steps:
25+
- name: Checkout Repository
26+
uses: actions/checkout@v4
27+
with:
28+
ref: ${{ inputs.tag || github.ref }}
29+
30+
- name: Resolve tag and version
31+
id: version
32+
run: |
33+
tag="${{ inputs.tag || github.ref_name }}"
34+
version="${tag#python-v}"
35+
pkg_version=$(awk -F'"' '/^version *=/ {print $2; exit}' pyproject.toml)
36+
if [ "$version" != "$pkg_version" ]; then
37+
echo "Tag $tag does not match pyproject.toml version $pkg_version" >&2
38+
exit 1
39+
fi
40+
41+
- name: Set Up Python
42+
uses: actions/setup-python@v5
43+
with:
44+
python-version: "3.12"
45+
46+
- name: Install build tooling
47+
run: pip install build
48+
49+
- name: Build sdist and wheel
50+
run: python -m build
51+
52+
- name: Publish to PyPI
53+
uses: pypa/gh-action-pypi-publish@release/v1
54+
with:
55+
packages-dir: client/python/dist

‎.github/workflows/release.yml‎

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: "Tag to release (e.g. v0.1.0) — must already exist"
11+
required: true
12+
13+
permissions:
14+
contents: write
15+
16+
jobs:
17+
build-and-release:
18+
name: Build and Release
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout Repository
22+
uses: actions/checkout@v4
23+
with:
24+
ref: ${{ inputs.tag || github.ref }}
25+
fetch-depth: 0
26+
27+
- name: Resolve tag and version
28+
id: version
29+
run: |
30+
tag="${{ inputs.tag || github.ref_name }}"
31+
version="${tag#v}"
32+
cargo_version=$(awk -F'"' '/^version *=/ {print $2; exit}' Cargo.toml)
33+
if [ "$version" != "$cargo_version" ]; then
34+
echo "Tag $tag does not match Cargo.toml version $cargo_version" >&2
35+
exit 1
36+
fi
37+
echo "tag=$tag" >> "$GITHUB_OUTPUT"
38+
39+
- name: Verify tag points at a commit on main
40+
run: |
41+
git fetch origin main
42+
if ! git merge-base --is-ancestor HEAD origin/main; then
43+
echo "Tagged commit $(git rev-parse HEAD) is not on main" >&2
44+
exit 1
45+
fi
46+
47+
- name: Install Rust toolchain
48+
uses: dtolnay/rust-toolchain@stable
49+
50+
- name: Build release binaries
51+
run: cargo build --release --workspace
52+
53+
- name: Run tests
54+
run: cargo test --release --workspace
55+
56+
- name: Create GitHub Release
57+
env:
58+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
TAG: ${{ steps.version.outputs.tag }}
60+
run: |
61+
gh release create "$TAG" \
62+
--title "$TAG" \
63+
--target "${{ github.sha }}" \
64+
--generate-notes
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Semantic Pull Request
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, edited, reopened, synchronize]
6+
7+
permissions:
8+
pull-requests: read
9+
10+
jobs:
11+
check:
12+
name: Check PR title
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: amannn/action-semantic-pull-request@v5
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
with:
19+
types: |
20+
feat
21+
fix
22+
docs
23+
style
24+
refactor
25+
perf
26+
test
27+
build
28+
ci
29+
chore
30+
revert

‎RELEASING.md‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Releasing VortexDB
2+
3+
This document describes the release process. It is intended for maintainers with push access to `main`.
4+
5+
## Branch model
6+
7+
- `main` is the only long-lived branch.
8+
- Direct pushes to `main` are disabled; all changes go through a PR.
9+
- PR titles must follow [Conventional Commits](https://www.conventionalcommits.org/), enforced by the `semantic-pull-request` check.
10+
11+
## Releasing the server (Rust)
12+
13+
Merging a PR into `main` does not trigger a release. Releases are triggered by pushing a version tag.
14+
15+
1. Bump `version` under `[workspace.package]` in the root `Cargo.toml`, and merge via PR.
16+
2. From `main`, tag and push:
17+
```
18+
git tag v0.1.0
19+
git push origin v0.1.0
20+
```
21+
3. The tag push triggers `.github/workflows/release.yml`, which:
22+
- Verifies the tag matches the version in `Cargo.toml`.
23+
- Verifies the tagged commit is on `main`.
24+
- Builds and runs the test suite.
25+
- Creates the GitHub Release.
26+
27+
A failing test suite stops the workflow before the release step runs.
28+
29+
## Releasing the Python client
30+
31+
The Python client (`client/python/`) is versioned and released independently of the server, using its own tag prefix.
32+
33+
1. Bump `version` in `client/python/pyproject.toml`, and merge via PR.
34+
2. Tag and push with the `python-v` prefix:
35+
```
36+
git tag python-v0.2.0
37+
git push origin python-v0.2.0
38+
```
39+
3. The tag push triggers `.github/workflows/publish-python.yml`, which builds the package and publishes to PyPI via [Trusted Publishing](https://docs.pypi.org/trusted-publishers/) (OIDC, no stored API token).
40+
41+
### One-time PyPI setup
42+
43+
1. On PyPI: project page → **Publishing** → add a GitHub publisher with owner `sdslabs`, repo `vector-db`, workflow `publish-python.yml`, environment `pypi`.
44+
2. On GitHub: Settings → Environments → create an environment named `pypi`, matching the `environment: pypi` value in the workflow.
45+
46+
## Secrets
47+
48+
Neither workflow requires manually configured secrets. `release.yml` uses the default `GITHUB_TOKEN`. `publish-python.yml` uses OIDC trusted publishing.
49+

0 commit comments

Comments
 (0)