Skip to content

Commit d6e66de

Browse files
committed
feat: Reinstated GitHub release workflow with semantic-release
- Added release.yml workflow for automated releases - Configured semantic-release with emoji commit parser - Added semantic-release to dev dependencies - Updated pyproject.toml with semantic-release tool config - Configured version variables for automatic version bumping
1 parent fd1d35f commit d6e66de

3 files changed

Lines changed: 97 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
contents: write
9+
packages: write
10+
11+
jobs:
12+
release:
13+
name: Create Release
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@v4
22+
with:
23+
version: "latest"
24+
enable-cache: true
25+
cache-dependency-glob: "pyproject.toml"
26+
27+
- name: Set up Python
28+
run: uv python install 3.9
29+
30+
- name: Install dependencies
31+
run: uv sync --group dev
32+
33+
- name: Run tests
34+
run: uv run pytest tests/ -v --tb=short
35+
36+
- name: Configure git for semantic-release
37+
run: |
38+
git config user.name "github-actions"
39+
git config user.email "github-actions@github.com"
40+
41+
- name: Run semantic-release
42+
env:
43+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
continue-on-error: true
45+
run: uv run semantic-release publish --ci || true
46+
47+
- name: Build distribution packages
48+
run: uv pip install build && uv run python -m build
49+
50+
- name: Upload artifacts to release
51+
env:
52+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
run: |
54+
# Get the latest tag
55+
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
56+
57+
if [ -n "$LATEST_TAG" ]; then
58+
# Upload wheel and sdist to the release
59+
gh release upload "$LATEST_TAG" dist/*.whl dist/*.tar.gz --clobber || true
60+
fi

.releaserc.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"branches": ["main"],
3+
"repository_url": "https://github.com/Abstract-Data/RyanData-Address-Utils",
4+
"changelog": {
5+
"exclude": {
6+
"labels": ["skip-changelog"]
7+
}
8+
},
9+
"plugins": [
10+
"@semantic-release/commit-analyzer",
11+
"@semantic-release/release-notes-generator",
12+
"@semantic-release/changelog",
13+
"@semantic-release/github",
14+
"@semantic-release/git"
15+
]
16+
}

pyproject.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ dev = [
4747
"mypy>=1.13.0",
4848
"pytest>=8.0.0",
4949
"hypothesis>=6.0.0",
50+
"python-semantic-release>=9.0.0",
5051
]
5152

5253
[build-system]
@@ -67,6 +68,26 @@ include = [
6768
target-version = "py39"
6869
line-length = 100
6970

71+
[tool.semantic_release]
72+
version_variables = [
73+
"pyproject.toml:version",
74+
"src/ryandata_address_utils/__init__.py:__version__",
75+
]
76+
version_toml = "pyproject.toml:project.version"
77+
commit_parser = "semantic_release.commit_parser.emoji"
78+
minor_tag = ":sparkles:"
79+
patch_tag = ":bug:"
80+
changelog_sections = [
81+
{type = "feat", section = "Features"},
82+
{type = "fix", section = "Bug Fixes"},
83+
{type = "docs", section = "Documentation"},
84+
{type = "style", section = "Style"},
85+
{type = "refactor", section = "Code Refactoring"},
86+
{type = "perf", section = "Performance Improvements"},
87+
{type = "test", section = "Tests"},
88+
{type = "chore", section = "Chores"},
89+
]
90+
7091
[tool.ruff.lint]
7192
select = ["E", "F", "I", "UP", "B", "SIM"]
7293
ignore = [

0 commit comments

Comments
 (0)