Skip to content

Commit cf52568

Browse files
committed
add: github workflow
modify: logger
1 parent 10b2d86 commit cf52568

File tree

3 files changed

+77
-4
lines changed

3 files changed

+77
-4
lines changed

.github/workflows/release.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Publish to PyPI and Create Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
7+
8+
jobs:
9+
build-publish-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: Check if version exists on PyPI
19+
id: check-pypi
20+
run: |
21+
TAG_VERSION="${GITHUB_REF##*/}"
22+
VERSION="${TAG_VERSION#v}"
23+
PKG="${GITHUB_REPOSITORY##*/}"
24+
EXISTS=$(curl -s https://pypi.org/pypi/${PKG}/json | jq -e ".releases[\"${VERSION}\"] | length > 0" 2>/dev/null && echo "true" || echo "false")
25+
EXISTS=$(echo $EXISTS | tr -d '\r\n')
26+
echo "skip_publish<<EOF" >> $GITHUB_OUTPUT
27+
echo "$EXISTS" >> $GITHUB_OUTPUT
28+
echo "EOF" >> $GITHUB_OUTPUT
29+
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
30+
shell: bash
31+
32+
- name: Version already exists on PyPI, skipping publish
33+
if: steps.check-pypi.outputs.skip_publish == 'true'
34+
run: |
35+
echo "Version already exists on PyPI. Skipping build and publish steps."
36+
exit 0
37+
38+
- name: Install uv
39+
uses: astral-sh/setup-uv@v5
40+
with:
41+
enable-cache: true
42+
43+
- name: Install the project
44+
run: uv sync --all-extras --dev
45+
46+
- name: Build package
47+
run: uv build
48+
49+
- name: Publish to PyPI
50+
run: uv publish --token ${{ secrets.PYPI_API_TOKEN }}
51+
52+
- name: Generate changelog
53+
id: changelog
54+
run: |
55+
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
56+
if [ -z "$PREV_TAG" ]; then
57+
CHANGELOG=$(git log --pretty=format:"- %s" ${{ github.sha }})
58+
else
59+
CHANGELOG=$(git log --pretty=format:"- %s" ${PREV_TAG}..HEAD)
60+
fi
61+
echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT
62+
echo "$CHANGELOG" >> $GITHUB_OUTPUT
63+
echo "EOF" >> $GITHUB_OUTPUT
64+
65+
- name: Create GitHub Release
66+
uses: softprops/action-gh-release@v2
67+
with:
68+
tag_name: v${{ steps.check-pypi.outputs.VERSION }}
69+
body: |
70+
## 🔄Changes
71+
${{ steps.changelog.outputs.CHANGELOG }}
72+
73+
## 📦Update
74+
```bash
75+
uv sync --force-reinstall
76+
```

pyhunt/logger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def _should_suppress_log(key):
4141

4242
def _format_truncation_message(event_type, depth):
4343
color = "grey50"
44-
msg = f"[{color}] ... Repeated logs have been omitted | MAX_LOG_COUNT: {MAX_REPEAT}[/]"
44+
msg = f"[{color}] ... Repeated logs have been omitted | MAX_REPEAT: {MAX_REPEAT}[/]"
4545
return format_with_tree_indent(msg, depth, event_type)
4646

4747

pyproject.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,3 @@ local_scheme = "no-local-version"
3434

3535
[tool.pytest.ini_options]
3636
testpaths = ["tests"]
37-
markers = [
38-
"e2e: marks tests as end-to-end tests (deselect with '-m \"not e2e\"')",
39-
]

0 commit comments

Comments
 (0)