Skip to content

Commit 7c218b5

Browse files
committed
fix: improve release pipeline and force bugfix release
1 parent 7a5ea8a commit 7c218b5

File tree

3 files changed

+20
-81
lines changed

3 files changed

+20
-81
lines changed

.github/workflows/release-to-discord.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: Discord Notification
2+
13
on:
24
release:
35
types: [published]
@@ -12,6 +14,6 @@ jobs:
1214
- name: Discord Release Webhook
1315
uses: lettermint/action-discord-releases@v1.0.1
1416
with:
15-
color: '3776ab'
17+
color: '4584b6'
1618
webhook_url: ${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }}
1719
content: 'A new release for the Lettermint Python SDK is now available! ||@Python||'

.github/workflows/release.yml

Lines changed: 17 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
name: Release
22

33
on:
4-
push:
5-
branches: [main]
6-
workflow_dispatch:
4+
release:
5+
types: [published]
76

87
permissions:
9-
contents: write
8+
contents: read
109
id-token: write
1110

1211
jobs:
13-
test-and-build:
14-
name: Test and Build
12+
release:
13+
name: Build and Publish
1514
runs-on: ubuntu-latest
1615

1716
steps:
1817
- name: Checkout code
1918
uses: actions/checkout@v4
20-
with:
21-
fetch-depth: 0
19+
20+
- name: Get version from tag
21+
id: version
22+
run: echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
2223

2324
- name: Set up Python
2425
uses: actions/setup-python@v5
@@ -32,68 +33,19 @@ jobs:
3233
pip install -e ".[dev]"
3334
pip install build
3435
35-
- name: Run tests
36-
run: python -m pytest tests/ -v
37-
38-
- name: Build package
39-
run: python -m build
40-
41-
- name: Upload build artifacts
42-
uses: actions/upload-artifact@v4
43-
with:
44-
name: release-artifacts
45-
path: |
46-
dist/
47-
pyproject.toml
48-
README.md
49-
LICENSE
50-
retention-days: 30
51-
52-
release:
53-
name: Release
54-
runs-on: ubuntu-latest
55-
needs: test-and-build
56-
if: github.ref == 'refs/heads/main'
57-
58-
steps:
59-
- name: Checkout code
60-
uses: actions/checkout@v4
61-
with:
62-
fetch-depth: 0
63-
token: ${{ secrets.GITHUB_TOKEN }}
64-
65-
- name: Set up Python
66-
uses: actions/setup-python@v5
67-
with:
68-
python-version: '3.12'
69-
cache: 'pip'
70-
71-
- name: Install dependencies
36+
- name: Update version in pyproject.toml
7237
run: |
73-
python -m pip install --upgrade pip
74-
pip install python-semantic-release build
38+
sed -i "s/^version = .*/version = \"${{ steps.version.outputs.version }}\"/" pyproject.toml
7539
76-
- name: Configure Git
40+
- name: Update version in __init__.py
7741
run: |
78-
git config user.name "github-actions[bot]"
79-
git config user.email "github-actions[bot]@users.noreply.github.com"
42+
sed -i "s/^__version__ = .*/__version__ = \"${{ steps.version.outputs.version }}\"/" src/lettermint/__init__.py
8043
81-
- name: Python Semantic Release
82-
id: release
83-
env:
84-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85-
run: |
86-
semantic-release version
87-
semantic-release publish
44+
- name: Run tests
45+
run: python -m pytest tests/ -v
8846

89-
- name: Download build artifacts
90-
uses: actions/download-artifact@v4
91-
with:
92-
name: release-artifacts
93-
path: artifacts/
47+
- name: Build package
48+
run: python -m build
9449

9550
- name: Publish to PyPI
96-
if: steps.release.outputs.released == 'true'
9751
uses: pypa/gh-action-pypi-publish@release/v1
98-
with:
99-
packages-dir: artifacts/dist/

pyproject.toml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,3 @@ ignore = [
8282

8383
[tool.ruff.lint.isort]
8484
known-first-party = ["lettermint"]
85-
86-
[tool.semantic_release]
87-
version_toml = ["pyproject.toml:project.version"]
88-
version_variables = ["src/lettermint/__init__.py:__version__"]
89-
branch = "main"
90-
build_command = "pip install build && python -m build"
91-
commit_message = "chore(release): {version} [skip ci]"
92-
93-
[tool.semantic_release.changelog]
94-
changelog_file = "CHANGELOG.md"
95-
96-
[tool.semantic_release.commit_parser_options]
97-
allowed_tags = ["build", "chore", "ci", "docs", "feat", "fix", "perf", "style", "refactor", "test"]
98-
minor_tags = ["feat"]
99-
patch_tags = ["fix", "perf"]

0 commit comments

Comments
 (0)