Skip to content

Commit 7f598ac

Browse files
committed
fix: ci
1 parent 8347554 commit 7f598ac

File tree

3 files changed

+210
-11
lines changed

3 files changed

+210
-11
lines changed

.github/workflows/build.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ jobs:
1313
RELEASE_NAME: ""
1414
TAG_NAME: ""
1515
PRERELEASE: ""
16+
RELEASE_BODY: ""
1617

1718
steps:
1819
- name: Checkout code
1920
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
2023

21-
# 这会默认启用 Rust Cache, 所以使用 Stable 版本与 Cargo.lock 配合缓存
2224
- name: Setup Rust
2325
uses: actions-rust-lang/setup-rust-toolchain@v1
2426
with:
@@ -32,8 +34,10 @@ jobs:
3234
3335
# 判断是否为预发布
3436
- name: Determine Release Type
37+
id: determine_release
38+
shell: bash
3539
run: |
36-
if ${{ github.event_name == 'workflow_dispatch' }}; then
40+
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
3741
echo "RELEASE_NAME=Defender-rs Nightly Build.$(date -u +'%Y.%m.%d')" >> $GITHUB_ENV
3842
echo "TAG_NAME=nightly" >> $GITHUB_ENV
3943
echo "PRERELEASE=true" >> $GITHUB_ENV
@@ -45,14 +49,13 @@ jobs:
4549
4650
- name: Read Release Note
4751
id: read_release_note
52+
shell: bash
4853
run: |
4954
if [ -f "./Release.md" ]; then
50-
# 读取文件内容并处理换行符,以便在后续步骤中使用
5155
notes_content=$(cat "./Release.md")
52-
notes_content="${notes_content//'%'/'%25'}"
53-
notes_content="${notes_content//$'\n'/'%0A'}"
54-
notes_content="${notes_content//$'\r'/'%0D'}"
55-
echo "content=${notes_content}" >> $GITHUB_OUTPUT
56+
echo "content<<EOF" >> $GITHUB_OUTPUT
57+
echo "$notes_content" >> $GITHUB_OUTPUT
58+
echo "EOF" >> $GITHUB_OUTPUT
5659
else
5760
echo "content=No release notes provided." >> $GITHUB_OUTPUT
5861
echo "::warning file=./Release.md::Release notes file not found. Using default message."
@@ -81,16 +84,18 @@ jobs:
8184

8285
- name: Construct Release Body
8386
id: construct_body
87+
shell: bash
8488
run: |
8589
release_body="${{ steps.read_release_note.outputs.content }}"
8690
if [[ "${{ env.PRERELEASE }}" == "false" && -n "${{ steps.generate_changelog.outputs.changelog }}" ]]; then
87-
release_body="${release_body}\n\n${{ steps.generate_changelog.outputs.changelog }}"
91+
release_body="${release_body}
92+
93+
${{ steps.generate_changelog.outputs.changelog }}"
8894
fi
8995
echo "body<<EOF" >> $GITHUB_OUTPUT
90-
echo -e "$release_body" >> $GITHUB_OUTPUT
96+
echo "$release_body" >> $GITHUB_OUTPUT
9197
echo "EOF" >> $GITHUB_OUTPUT
9298
93-
# 创建 Release 并上传构建产物
9499
- name: Create Release
95100
id: create_release
96101
uses: softprops/action-gh-release@v1

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
/target
2-
/Cargo.lock

Cargo.lock

Lines changed: 195 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)