Skip to content

Commit 1bf2290

Browse files
yfgeclaudepre-commit-ci[bot]
authored
feat: add automated release workflow with version management (#11)
feat: add markdownlint integration for consistent documentation quality (#10) * feat: add editorconfig focused on Python backend development (#8) - Add Python configuration with 4-space indentation and 200-char line length - Configure YAML/JSON files with 2-space indentation - Add Markdown configuration with UTF-8 encoding, preserve trailing whitespace - Add TOML configuration for config files - Remove JavaScript/TypeScript frontend configurations to focus on backend needs - Ensure consistent formatting across all project file types 🤖 Generated with [Claude Code](https://claude.ai/code) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Claude <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 70945f3 commit 1bf2290

File tree

1 file changed

+102
-0
lines changed

1 file changed

+102
-0
lines changed

.github/workflows/release.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- '**/*.md'
9+
- 'docs/**'
10+
workflow_dispatch:
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
issues: write
18+
pull-requests: write
19+
id-token: write
20+
21+
steps:
22+
- name: Check out repository
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
token: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Set up Python
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: '3.11'
32+
33+
- name: Install dependencies
34+
run: |
35+
python -m pip install --upgrade pip
36+
pip install commitizen build twine
37+
38+
- name: Configure Git
39+
run: |
40+
git config --local user.email "[email protected]"
41+
git config --local user.name "GitHub Action"
42+
43+
- name: Bump version automatically
44+
id: bump-version
45+
run: |
46+
# Check if we need to bump version based on conventional commits
47+
if cz bump --dry-run --changelog 2>/dev/null; then
48+
echo "bump_needed=true" >> $GITHUB_OUTPUT
49+
cz bump --changelog --yes
50+
git push origin main --follow-tags
51+
else
52+
echo "bump_needed=false" >> $GITHUB_OUTPUT
53+
echo "No version bump needed based on commit messages"
54+
fi
55+
56+
- name: Get version
57+
id: version
58+
run: |
59+
VERSION=$(python -c "import markdown_flow; print(markdown_flow.__version__)")
60+
echo "version=$VERSION" >> $GITHUB_OUTPUT
61+
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
62+
63+
- name: Check if tag exists
64+
id: check-tag
65+
run: |
66+
if git tag -l "${{ steps.version.outputs.tag }}" | grep -q .; then
67+
echo "exists=true" >> $GITHUB_OUTPUT
68+
else
69+
echo "exists=false" >> $GITHUB_OUTPUT
70+
fi
71+
72+
- name: Build package
73+
if: steps.bump-version.outputs.bump_needed == 'true' || steps.check-tag.outputs.exists == 'false'
74+
run: |
75+
python -m build
76+
77+
- name: Publish to PyPI
78+
if: steps.bump-version.outputs.bump_needed == 'true' || steps.check-tag.outputs.exists == 'false'
79+
uses: pypa/gh-action-pypi-publish@release/v1
80+
with:
81+
password: ${{ secrets.PYPI_TOKEN }}
82+
skip-existing: true
83+
84+
- name: Create GitHub Release
85+
if: steps.bump-version.outputs.bump_needed == 'true' || steps.check-tag.outputs.exists == 'false'
86+
uses: softprops/action-gh-release@v2
87+
with:
88+
tag_name: ${{ steps.version.outputs.tag }}
89+
name: Release ${{ steps.version.outputs.tag }}
90+
body: |
91+
## Changes in ${{ steps.version.outputs.tag }}
92+
93+
See [CHANGELOG.md](https://github.com/ai-shifu/markdown-flow-agent-py/blob/main/CHANGELOG.md) for detailed changes.
94+
95+
## Installation
96+
```bash
97+
pip install markdown-flow==${{ steps.version.outputs.version }}
98+
```
99+
files: |
100+
dist/*
101+
draft: false
102+
prerelease: false

0 commit comments

Comments
 (0)