Skip to content

Commit 965a5f5

Browse files
committed
Add changelog, update README with badges, and create PyPI publish workflow
- Added CHANGELOG.md to document project changes and adhere to Semantic Versioning. - Updated README.md to include badges for CI, PyPI version, Python compatibility, and license. - Introduced GitHub Actions workflow for automated publishing to PyPI upon version tag pushes.
1 parent f26bc10 commit 965a5f5

File tree

3 files changed

+91
-0
lines changed

3 files changed

+91
-0
lines changed

.github/workflows/publish.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
id-token: write
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.9'
22+
23+
- name: Install build dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install build
27+
28+
- name: Build package
29+
run: python -m build
30+
31+
- name: Extract changelog
32+
id: changelog
33+
env:
34+
TAG_NAME: ${{ github.ref_name }}
35+
run: |
36+
python <<'PY'
37+
import os
38+
import pathlib
39+
import re
40+
41+
tag = os.environ["TAG_NAME"]
42+
version = tag[1:] if tag.startswith("v") else tag
43+
44+
changelog_path = pathlib.Path("CHANGELOG.md")
45+
if changelog_path.exists():
46+
changelog = changelog_path.read_text()
47+
pattern = re.compile(rf"^## \[{re.escape(version)}\][^\n]*\n(.*?)(?=\n## \[|\Z)", re.DOTALL | re.MULTILINE)
48+
section = pattern.search(changelog)
49+
body = section.group(1).strip() if section else f"Release {version}"
50+
else:
51+
body = f"Release {version}"
52+
53+
if not body:
54+
body = f"Release {version}"
55+
56+
output = pathlib.Path("release_notes.md")
57+
output.write_text(body + "\n")
58+
print(body)
59+
PY
60+
61+
- name: Create Release
62+
uses: softprops/action-gh-release@v2
63+
with:
64+
body_path: release_notes.md
65+
generate_release_notes: false
66+
67+
- name: Publish to PyPI
68+
uses: pypa/gh-action-pypi-publish@release/v1
69+
with:
70+
password: ${{ secrets.PYPI_API_TOKEN }}
71+

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [0.1.0] - 2025-12-27
9+
10+
### Added
11+
- Initial release
12+
- CLI tool to convert natural language prompts to structured JSON API responses
13+
- JSON Schema validation support
14+
- OpenAI integration with structured output format
15+
- Minimal dependencies and CLI-first design

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# ask2api
22

3+
[![CI](https://github.com/atasoglu/ask2api/actions/workflows/pre-commit.yml/badge.svg)](https://github.com/atasoglu/ask2api/actions/workflows/pre-commit.yml)
4+
[![PyPI version](https://badge.fury.io/py/ask2api.svg)](https://badge.fury.io/py/ask2api)
5+
[![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
6+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7+
38
`ask2api` is a minimal Python CLI tool that turns natural language prompts into structured API-style JSON responses using LLM.
49

510
It allows you to define a JSON Schema and force the model to answer strictly in that format.

0 commit comments

Comments
 (0)