Skip to content

Commit c347765

Browse files
committed
chore: bump version to 1.0.2 and switch to git-cliff for releases
- Add git-cliff changelog generation workflow - Separate Python CI/CD from GitHub release creation - Remove redundant lint workflow (integrated into main workflow) - Clean separation: Python workflow creates tags, git-cliff creates releases
1 parent 3b59b94 commit c347765

File tree

5 files changed

+98
-44
lines changed

5 files changed

+98
-44
lines changed

.github/cliff.toml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[changelog]
2+
body = """
3+
{%- macro remote_url() -%}
4+
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
5+
{%- endmacro -%}
6+
7+
{% for group, commits in commits | group_by(attribute="group") %}
8+
### {{ group | striptags | trim | upper_first }}
9+
{% for commit in commits %}
10+
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}{% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }} - ([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))
11+
{%- endfor %}
12+
{% endfor %}
13+
"""
14+
trim = true
15+
16+
[git]
17+
conventional_commits = true
18+
filter_unconventional = true
19+
protect_breaking_commits = true
20+
commit_parsers = [
21+
{ message = "^feat", group = "✨ Features" },
22+
{ message = "^fix", group = "🐛 Bug Fixes" },
23+
{ message = "^doc", group = "📚 Documentation" },
24+
{ message = "^perf", group = "⚡ Performance" },
25+
{ message = "^refactor", group = "♻️ Refactor" },
26+
{ message = "^style", group = "🎨 Styling" },
27+
{ message = "^test", group = "🧪 Testing" },
28+
{ message = "^chore\\(release\\): prepare for", skip = true },
29+
{ message = "^chore\\(deps.*\\)", skip = true },
30+
{ message = "^chore", group = "🧹 Miscellaneous Tasks" },
31+
{ message = "^ci|^cd", group = "🏭 CI/CD" },
32+
{ body = ".*security", group = "🛡️ Security" },
33+
{ message = "^revert", group = "⏪ Revert" },
34+
]

.github/workflows/git-cliff.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Create Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Generate Changelog
19+
id: git-cliff
20+
uses: orhun/git-cliff-action@v4
21+
with:
22+
config: .github/cliff.toml
23+
args: --latest
24+
env:
25+
OUTPUT: CHANGELOG.md
26+
GITHUB_REPO: ${{ github.repository }}
27+
28+
- name: Create GitHub Release
29+
uses: softprops/action-gh-release@v2
30+
with:
31+
body: ${{ steps.git-cliff.outputs.content }}
32+
draft: false
33+
prerelease: false

.github/workflows/lint.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,45 @@
1-
name: Release to PyPI
1+
name: Python CI/CD
22

33
on:
44
push:
55
branches: [main]
6+
pull_request:
7+
branches: [main]
68

79
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Install uv
16+
uses: astral-sh/setup-uv@v5
17+
with:
18+
enable-cache: true
19+
20+
- name: Set up Python
21+
run: uv python install 3.12
22+
23+
- name: Install dependencies
24+
run: uv sync --all-extras
25+
26+
- name: Run ruff check
27+
run: uv run ruff check
28+
29+
- name: Run ruff format check
30+
run: uv run ruff format --check
31+
832
publish:
33+
needs: lint
34+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
935
runs-on: ubuntu-latest
10-
environment:
11-
name: pypi
12-
url: https://pypi.org/p/namecheap-python
1336
permissions:
1437
id-token: write
1538
contents: write
1639
steps:
1740
- uses: actions/checkout@v4
41+
with:
42+
fetch-depth: 0
1843

1944
- name: Set up Python
2045
uses: actions/setup-python@v5
@@ -62,12 +87,4 @@ jobs:
6287
git config user.name github-actions
6388
git config user.email github-actions@github.com
6489
git tag -a "v$VERSION" -m "Release v$VERSION"
65-
git push origin "v$VERSION"
66-
67-
- name: Create GitHub Release
68-
if: steps.check.outputs.exists == 'false'
69-
uses: softprops/action-gh-release@v2
70-
with:
71-
tag_name: v${{ steps.check.outputs.version }}
72-
name: v${{ steps.check.outputs.version }}
73-
generate_release_notes: true
90+
git push origin "v$VERSION"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "namecheap-python"
3-
version = "1.0.1"
3+
version = "1.0.2"
44
description = "A friendly Python SDK for Namecheap API"
55
authors = [{name = "Adrian Galilea Delgado", email = "adriangalilea@gmail.com"}]
66
readme = "README.md"

0 commit comments

Comments
 (0)