Skip to content

Commit 9dd8e9b

Browse files
rx-devrx
authored andcommitted
feat: update to 3.14, uv, beet/bolt
1 parent 329d638 commit 9dd8e9b

5 files changed

Lines changed: 114 additions & 339 deletions

File tree

.github/workflows/main.yml

Lines changed: 64 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@ on:
55
pull_request:
66
workflow_dispatch:
77

8+
env:
9+
PYTHON_VERSION: "3.14"
10+
811
jobs:
912
main:
1013
name: Test and release
1114
runs-on: ubuntu-latest
15+
outputs:
16+
released: ${{ steps.release.outputs.released }}
17+
tag: ${{ steps.release.outputs.tag }}
1218

1319
steps:
1420
- uses: actions/checkout@v6
@@ -18,24 +24,37 @@ jobs:
1824
- name: Set up Python 3.14
1925
uses: actions/setup-python@v6
2026
with:
21-
python-version: "3.14"
27+
python-version: ${{ env.PYTHON_VERSION }}
2228

2329
- name: Install uv
2430
uses: astral-sh/setup-uv@v7
2531
with:
2632
enable-cache: true
2733

2834
- name: Install dependencies
29-
run: uv sync
35+
run: uv sync --all-groups
3036

3137
- name: Run tests
3238
run: uv run pytest -v
3339

34-
- name: Check formatting
35-
run: uv run ruff format --check bolt_control_flow examples tests
40+
- name: Check linting, formatting, imports
41+
run: uv run ruff check
42+
43+
- name: Action | Semantic Version Release
44+
id: release
45+
run: |
46+
# 1. Run the versioning logic
47+
uv run semantic-release version
3648
37-
- name: Check imports
38-
run: uv run ruff check --select I bolt_control_flow examples tests
49+
# 2. Extract version info for subsequent steps
50+
echo "tag=$(uv run semantic-release version --print-tag)" >> $GITHUB_OUTPUT
51+
52+
# 3. Check if a release actually happened
53+
if [ -d "dist" ] && [ "$(ls -A dist)" ]; then
54+
echo "released=true" >> $GITHUB_OUTPUT
55+
fi
56+
env:
57+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3958

4059
- name: Build docs
4160
run: |
@@ -45,22 +64,44 @@ jobs:
4564
poetry run make html
4665
cp -r build/* ../gh-pages/
4766
48-
- name: Release
49-
if: |
50-
github.repository == 'vdvman1/bolt-control-flow'
51-
&& github.event_name == 'push'
52-
&& github.ref == 'refs/heads/main'
53-
env:
54-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55-
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
56-
run: |
57-
git config --global user.name "github-actions"
58-
git config --global user.email "action@github.com"
59-
uv run semantic-release publish -v DEBUG -D commit_author="github-actions <action@github.com>"
67+
- name: Publish | Upload to GitHub Release Assets
68+
uses: python-semantic-release/publish-action@v10.5.3
69+
if: steps.release.outputs.released == 'true'
70+
with:
71+
github_token: ${{ secrets.GITHUB_TOKEN }}
72+
tag: ${{ steps.release.outputs.tag }}
73+
74+
- name: Upload | Distribution Artifacts
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: distribution-artifacts
78+
path: dist
79+
if-no-files-found: error
80+
81+
deploy:
82+
# 1. Separate out the deploy step from the publish step to run each step at
83+
# the least amount of token privilege
84+
# 2. Also, deployments can fail, and its better to have a separate job if you need to retry
85+
# and it won't require reversing the release.
86+
runs-on: ubuntu-latest
87+
needs: release
88+
if: ${{ needs.release.outputs.released == 'true' }}
89+
90+
permissions:
91+
contents: read
92+
id-token: write
93+
94+
steps:
95+
- name: Setup | Download Build Artifacts
96+
uses: actions/download-artifact@v4
97+
id: artifact-download
98+
with:
99+
name: distribution-artifacts
100+
path: dist
60101

61-
- name: Publish docs
62-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
63-
uses: JamesIves/github-pages-deploy-action@4.1.4
102+
- name: Publish package distributions to PyPI
103+
uses: pypa/gh-action-pypi-publish@release/v1
64104
with:
65-
branch: gh-pages
66-
folder: gh-pages
105+
packages-dir: dist
106+
print-hash: true
107+
verbose: true

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ pip install bolt_control_flow
1313
---
1414

1515
License - [MIT](https://github.com/vdvman1/bolt-control-flow/blob/main/LICENSE)
16-

bolt_control_flow/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def binary_logical(
5555
case BinaryLogicalFallback():
5656
# Avoid calling the original right function again
5757
# Reuse existing value instead
58-
right = lambda: fallback_right_value
58+
right = lambda: fallback_right_value # noqa: E731 (use def instead of lambda)
5959
case res:
6060
return res
6161
case res:

pyproject.toml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ dev = [
3838
"pytest>=7.1.3,<8",
3939
"pytest-insta>=0.1.11,<0.2",
4040
"lectern>=0.25.0",
41-
"python-semantic-release>=7.32.1,<8",
41+
"python-semantic-release>=9.21.0",
4242
"ruff>=0.14.13",
4343
]
4444
docs = [
@@ -55,6 +55,9 @@ default-groups = ["dev"]
5555
module-root = ""
5656
source-include = ["bolt_control_flow/py.typed"]
5757

58+
[tool.ruff.lint]
59+
ignore = ["F403", "F405"] # allows "*" imports
60+
5861
[build-system]
5962
build-backend = "uv_build"
6063
requires = ["uv_build>=0.9.26,<0.10.0"]
@@ -63,9 +66,9 @@ requires = ["uv_build>=0.9.26,<0.10.0"]
6366
addopts = "tests --import-mode=importlib"
6467

6568
[tool.semantic_release]
66-
branch = "main"
6769
build_command = "uv build"
6870
major_on_zero = false
69-
upload_to_repository = true
70-
version_toml = "pyproject.toml:project.version"
71-
version_variable = "bolt_control_flow/__init__.py:__version__"
71+
72+
commit_author = "github-actions <action@github.com>"
73+
version_toml = ["pyproject.toml:project.version"]
74+
version_variables = ["bolt_control_flow/__init__.py:__version__"]

0 commit comments

Comments
 (0)