Skip to content
This repository was archived by the owner on Dec 23, 2025. It is now read-only.

Commit 48d01a1

Browse files
committed
fix: refactor release workflow to fix checksums generation
- Replace deprecated actions/create-release and upload-release-asset with softprops/action-gh-release - Add upload-artifact step to enable checksums generation - Simplify workflow from 3 jobs to 2 jobs (build → release) - Auto-generate release notes
1 parent 6290b7c commit 48d01a1

2 files changed

Lines changed: 42 additions & 52 deletions

File tree

.github/workflows/release.yml

Lines changed: 39 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,7 @@ permissions:
1414
contents: write
1515

1616
jobs:
17-
create-release:
18-
runs-on: ubuntu-latest
19-
outputs:
20-
upload_url: ${{ steps.create_release.outputs.upload_url }}
21-
version: ${{ steps.get_version.outputs.version }}
22-
steps:
23-
- name: Get version from tag
24-
id: get_version
25-
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
26-
27-
- name: Create Release
28-
id: create_release
29-
uses: actions/create-release@v1
30-
env:
31-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32-
with:
33-
tag_name: ${{ github.ref }}
34-
release_name: Release ${{ github.ref_name }}
35-
draft: false
36-
prerelease: ${{ contains(github.ref, '-') }}
37-
3817
build:
39-
needs: create-release
4018
strategy:
4119
fail-fast: false
4220
matrix:
@@ -85,8 +63,7 @@ jobs:
8563
sudo apt-get install -y gcc-aarch64-linux-gnu
8664
;;
8765
aarch64-unknown-linux-musl)
88-
sudo apt-get install -y musl-tools gcc-aarch64-linux-gnu
89-
# Install aarch64 musl cross compiler
66+
# Install aarch64 musl cross compiler from musl.cc
9067
wget -q https://musl.cc/aarch64-linux-musl-cross.tgz
9168
tar -xzf aarch64-linux-musl-cross.tgz
9269
echo "$PWD/aarch64-linux-musl-cross/bin" >> $GITHUB_PATH
@@ -99,63 +76,73 @@ jobs:
9976
mkdir -p .cargo
10077
case "${{ matrix.target }}" in
10178
aarch64-unknown-linux-gnu)
102-
echo '[target.aarch64-unknown-linux-gnu]' >> .cargo/config.toml
103-
echo 'linker = "aarch64-linux-gnu-gcc"' >> .cargo/config.toml
79+
cat >> .cargo/config.toml << 'EOF'
80+
[target.aarch64-unknown-linux-gnu]
81+
linker = "aarch64-linux-gnu-gcc"
82+
EOF
10483
;;
10584
aarch64-unknown-linux-musl)
106-
echo '[target.aarch64-unknown-linux-musl]' >> .cargo/config.toml
107-
echo 'linker = "aarch64-linux-musl-gcc"' >> .cargo/config.toml
85+
cat >> .cargo/config.toml << 'EOF'
86+
[target.aarch64-unknown-linux-musl]
87+
linker = "aarch64-linux-musl-gcc"
88+
EOF
10889
;;
10990
esac
11091
11192
- name: Build
11293
run: cargo build --release --target ${{ matrix.target }} -p relay-server
11394

95+
- name: Get version
96+
id: version
97+
shell: bash
98+
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
99+
114100
- name: Package (Unix)
115101
if: matrix.os != 'windows-latest'
116102
run: |
117103
cd target/${{ matrix.target }}/release
118-
tar -czvf ../../../${{ env.BINARY_NAME }}-${{ needs.create-release.outputs.version }}-${{ matrix.target }}.tar.gz ${{ env.BINARY_NAME }}
104+
tar -czvf ../../../${{ env.BINARY_NAME }}-${{ steps.version.outputs.version }}-${{ matrix.target }}.tar.gz ${{ env.BINARY_NAME }}
119105
120106
- name: Package (Windows)
121107
if: matrix.os == 'windows-latest'
122108
shell: pwsh
123109
run: |
124110
cd target/${{ matrix.target }}/release
125-
Compress-Archive -Path ${{ env.BINARY_NAME }}.exe -DestinationPath ../../../${{ env.BINARY_NAME }}-${{ needs.create-release.outputs.version }}-${{ matrix.target }}.zip
111+
Compress-Archive -Path ${{ env.BINARY_NAME }}.exe -DestinationPath ../../../${{ env.BINARY_NAME }}-${{ steps.version.outputs.version }}-${{ matrix.target }}.zip
126112
127-
- name: Upload Release Asset
128-
uses: actions/upload-release-asset@v1
129-
env:
130-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113+
- name: Upload artifact
114+
uses: actions/upload-artifact@v4
131115
with:
132-
upload_url: ${{ needs.create-release.outputs.upload_url }}
133-
asset_path: ./${{ env.BINARY_NAME }}-${{ needs.create-release.outputs.version }}-${{ matrix.target }}.${{ matrix.archive }}
134-
asset_name: ${{ env.BINARY_NAME }}-${{ needs.create-release.outputs.version }}-${{ matrix.target }}.${{ matrix.archive }}
135-
asset_content_type: ${{ matrix.archive == 'zip' && 'application/zip' || 'application/gzip' }}
116+
name: ${{ env.BINARY_NAME }}-${{ matrix.target }}
117+
path: ${{ env.BINARY_NAME }}-${{ steps.version.outputs.version }}-${{ matrix.target }}.${{ matrix.archive }}
118+
if-no-files-found: error
136119

137-
checksums:
138-
needs: [create-release, build]
120+
release:
121+
needs: build
139122
runs-on: ubuntu-latest
140123
steps:
124+
- name: Get version
125+
id: version
126+
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
127+
141128
- name: Download all artifacts
142129
uses: actions/download-artifact@v4
143130
with:
144131
path: artifacts
145132
merge-multiple: true
146133

147134
- name: Generate checksums
135+
working-directory: artifacts
148136
run: |
149-
cd artifacts 2>/dev/null || exit 0
150-
sha256sum * > checksums-sha256.txt || true
151-
152-
- name: Upload checksums
153-
if: hashFiles('artifacts/checksums-sha256.txt') != ''
154-
uses: actions/upload-release-asset@v1
155-
env:
156-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
137+
sha256sum * > checksums-sha256.txt
138+
cat checksums-sha256.txt
139+
140+
- name: Create Release
141+
uses: softprops/action-gh-release@v2
157142
with:
158-
upload_url: ${{ needs.create-release.outputs.upload_url }}
159-
asset_path: artifacts/checksums-sha256.txt
160-
asset_name: checksums-sha256.txt
161-
asset_content_type: text/plain
143+
name: Release v${{ steps.version.outputs.version }}
144+
draft: false
145+
prerelease: ${{ contains(github.ref, '-') }}
146+
generate_release_notes: true
147+
files: |
148+
artifacts/*

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121

2222
### Fixed
2323

24+
- 修复 GitHub Actions release workflow 无法正确生成 checksums 的问题
25+
- 替换废弃的 `actions/create-release``upload-release-asset``softprops/action-gh-release`
26+
- 添加 artifact 上传步骤,确保 checksums 生成正常工作
2427
- 修复 Claude API 响应中未知 content 类型导致 400 错误的问题
2528
- `MessagesResponse.content``Vec<ContentBlock>` 改为 `serde_json::Value` 实现完全透传
2629
- 解决了 `thinking``tool_result` 等新类型被序列化为 `{"type": "Unknown"}` 的问题

0 commit comments

Comments
 (0)