Skip to content

Commit ffa7f67

Browse files
committed
chore: bump version to 0.2.0; add auto-release workflow
1 parent d20a576 commit ffa7f67

2 files changed

Lines changed: 66 additions & 1 deletion

File tree

.github/workflows/auto-release.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Auto release
2+
3+
# Triggers on every push to master. Skips its own version-bump commits to
4+
# prevent an infinite loop.
5+
on:
6+
push:
7+
branches: [master]
8+
9+
jobs:
10+
release:
11+
if: "!startsWith(github.event.head_commit.message, 'chore: bump version')"
12+
runs-on: ubuntu-latest
13+
environment: pypi
14+
permissions:
15+
contents: write # push version-bump commit + tag back to master
16+
id-token: write # OIDC trusted publishing to PyPI (no token needed)
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.11"
26+
27+
- name: Bump patch version
28+
id: version
29+
run: |
30+
python - << 'PYEOF'
31+
import re, os
32+
content = open("pyproject.toml").read()
33+
m = re.search(r'(version = ")(\d+\.\d+\.)(\d+)(")', content)
34+
new_ver = m.group(2) + str(int(m.group(3)) + 1)
35+
new_content = re.sub(
36+
r'(version = ")\d+\.\d+\.\d+(")',
37+
rf'\g<1>{new_ver}\2',
38+
content, count=1,
39+
)
40+
open("pyproject.toml", "w").write(new_content)
41+
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
42+
f.write(f"version={new_ver}\n")
43+
print(f"Bumped to {new_ver}")
44+
PYEOF
45+
46+
- name: Install build tools
47+
run: pip install hatchling build
48+
49+
- name: Build
50+
run: python -m build
51+
52+
- name: Publish to PyPI
53+
uses: pypa/gh-action-pypi-publish@release/v1
54+
# Uses OIDC trusted publishing — no API token required.
55+
# Ensure this repo + workflow is registered at:
56+
# https://pypi.org/manage/project/vocametrix/settings/publishing/
57+
58+
- name: Commit version bump and push tag
59+
run: |
60+
git config user.name "github-actions[bot]"
61+
git config user.email "github-actions[bot]@users.noreply.github.com"
62+
git add pyproject.toml
63+
git commit -m "chore: bump version to ${{ steps.version.outputs.version }}"
64+
git tag "v${{ steps.version.outputs.version }}"
65+
git push origin master --follow-tags

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "vocametrix"
7-
version = "0.1.0"
7+
version = "0.2.0"
88
description = "Official Python SDK for the Vocametrix voice analysis API"
99
readme = "README.md"
1010
license = { file = "LICENSE" }

0 commit comments

Comments
 (0)