fix(article): 添加自定义反序列化逻辑以支持字符串或整数类型的用户头像类型 #38
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' # 匹配 vX.Y.Z 格式的标签 | |
| # 添加权限配置,适用于所有 jobs | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| # Windows | |
| - target: x86_64-pc-windows-msvc | |
| os: windows-latest | |
| archive-name: fishpi-client-windows-x64.zip | |
| # Linux | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| archive-name: fishpi-client-linux-x64.tar.gz | |
| # macOS | |
| - target: x86_64-apple-darwin | |
| os: macos-latest | |
| archive-name: fishpi-client-macos-x64.tar.gz | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Build client | |
| run: cargo build --release --target ${{ matrix.target }} --bin client | |
| - name: Package Windows | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| New-Item -ItemType Directory -Path "release" -Force | |
| Copy-Item "target\${{ matrix.target }}\release\client.exe" "release\client-windows.exe" | |
| - name: Package Linux | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| mkdir -p release | |
| cp target/${{ matrix.target }}/release/client release/client-linux | |
| - name: Package macOS | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| mkdir -p release | |
| cp target/${{ matrix.target }}/release/client release/client-macos | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.target }} | |
| path: release/* | |
| create-release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Get current tag version | |
| id: version | |
| run: echo "VERSION=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT | |
| - name: Get previous tag | |
| id: prev_tag | |
| run: | | |
| CURRENT_TAG="${GITHUB_REF_NAME}" | |
| git fetch --tags | |
| PREV_TAG=$(git tag --sort=-creatordate | grep -v "$CURRENT_TAG" | head -n 1) | |
| if [ -z "$PREV_TAG" ]; then | |
| echo "No previous tag found. This might be the first release." | |
| echo "PREV_TAG=" >> $GITHUB_OUTPUT | |
| else | |
| echo "Previous tag found: $PREV_TAG" | |
| echo "PREV_TAG=$PREV_TAG" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Generate changelog | |
| id: changelog | |
| run: | | |
| CURRENT_TAG="${GITHUB_REF_NAME}" | |
| PREV_TAG="${{ steps.prev_tag.outputs.PREV_TAG }}" | |
| echo "Generating changelog from $PREV_TAG to $CURRENT_TAG" | |
| CHANGELOG_CONTENT="" | |
| if [ -z "$PREV_TAG" ]; then | |
| CHANGELOG_CONTENT=$(git log --pretty=format:"* %s (%an)") | |
| else | |
| CHANGELOG_CONTENT=$(git log "$PREV_TAG..$CURRENT_TAG" --pretty=format:"* %s (%an)") | |
| fi | |
| echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT | |
| echo "$CHANGELOG_CONTENT" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ steps.version.outputs.VERSION }} | |
| name: FishPi Client ${{ steps.version.outputs.VERSION }} | |
| body: | | |
| ## FishPi 聊天室Rust命令行客户端 ${{ steps.version.outputs.VERSION }} | |
| ### 更新内容 | |
| ${{ steps.changelog.outputs.CHANGELOG }} | |
| ### 下载 | |
| - **Windows**: `client-windows.exe` | |
| - **Linux**: `client-linux` | |
| - **macOS**: `client-macos` | |
| ### 使用方法 | |
| 1. 下载对应平台的文件 | |
| 2. 运行 `client` 程序 | |
| files: | | |
| artifacts/*/client-windows.exe | |
| artifacts/*/client-linux | |
| artifacts/*/client-macos | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |