From b51bb9058ff6f60831aed4afa148afcd0aa7c924 Mon Sep 17 00:00:00 2001 From: cloxl Date: Thu, 15 Jan 2026 19:01:20 +0800 Subject: [PATCH] fix(ci): improve release notes generation and fix version format --- .github/workflows/release.yml | 75 ++++++++++++++++++++++++++++++----- 1 file changed, 65 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6b896aa..da2e150 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,6 +16,33 @@ jobs: contents: write steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Generate release notes + id: release_notes + run: | + VERSION="${{ github.ref_name }}" + VERSION_NO_V="${VERSION#v}" + + # Get previous tag + PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") + + # Generate changelog + echo "CHANGELOG<> $GITHUB_OUTPUT + if [ -n "$PREV_TAG" ]; then + echo "## What's Changed" >> $GITHUB_OUTPUT + echo "" >> $GITHUB_OUTPUT + git log ${PREV_TAG}..HEAD --pretty=format:"- %s (%h)" --no-merges >> $GITHUB_OUTPUT + echo "" >> $GITHUB_OUTPUT + echo "" >> $GITHUB_OUTPUT + echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/${PREV_TAG}...${VERSION}" >> $GITHUB_OUTPUT + else + echo "Initial release" >> $GITHUB_OUTPUT + fi + echo "EOF" >> $GITHUB_OUTPUT + + echo "VERSION_NO_V=${VERSION_NO_V}" >> $GITHUB_OUTPUT - name: Create GitHub Release uses: softprops/action-gh-release@v2 @@ -24,37 +51,65 @@ jobs: name: Release ${{ github.ref_name }} draft: false prerelease: false + generate_release_notes: true body: | - ## 更新内容 + ${{ steps.release_notes.outputs.CHANGELOG }} + + ## Installation - ## 安装 + ```bash + pip install xhshow==${{ steps.release_notes.outputs.VERSION_NO_V }} + ``` + + Or upgrade from previous version: ```bash - pip install xhshow==${{ github.ref_name }} + pip install --upgrade xhshow ``` - ## 使用方法 + ## Quick Start ```python - from xhshow import Xhshow + from xhshow import Xhshow, SessionManager + # Basic usage client = Xhshow() - # GET请求签名 + # GET request signature signature = client.sign_xs_get( uri="/api/sns/web/v1/user_posted", a1_value="your_a1_cookie_value", - params={"num": "30", "cursor": "", "user_id": "123"} + params={"num": "30", "user_id": "123"} ) - # POST请求签名 + # POST request signature signature = client.sign_xs_post( - uri="/api/sns/web/v1/login", + uri="/api/sns/web/v1/comment/post", a1_value="your_a1_cookie_value", - payload={"username": "test", "password": "123456"} + payload={"note_id": "123", "content": "Great!"} + ) + + # Generate complete headers with session management + session = SessionManager() + headers = client.sign_headers_get( + uri="/api/sns/web/v1/homefeed", + cookies={"a1": "your_a1_value", "web_session": "..."}, + params={"page": "1"}, + session=session ) ``` + ## Documentation + + - [GitHub Repository](https://github.com/${{ github.repository }}) + - [PyPI Package](https://pypi.org/project/xhshow/${{ steps.release_notes.outputs.VERSION_NO_V }}/) + + ## Supported Python Versions + + - Python 3.10+ + - Python 3.11 + - Python 3.12 + pypi: name: Publish to PyPI runs-on: ubuntu-latest