Skip to content

Commit 2ef271a

Browse files
更新部署通知逻辑,添加成功和失败状态消息;新增 Hello World 博客文章
1 parent 1f7561a commit 2ef271a

3 files changed

Lines changed: 24 additions & 8 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,18 @@ jobs:
4343
- name: Send PushPlus Notification
4444
if: always() # 无论成功或失败都执行
4545
run: |
46+
if [ "${{ job.status }}" = "success" ]; then
47+
STATUS_MSG="✅ 部署成功\n项目已构建并上传至 COS\n分支:${{ github.ref_name }}"
48+
else
49+
STATUS_MSG="❌ 部署失败\n请检查 GitHub Actions 日志\n分支:${{ github.ref_name }}"
50+
fi
51+
4652
curl -X POST \
4753
-H "Content-Type: application/json" \
48-
-d '{
49-
"token": "${{ secrets.PUSHPLUS_TOKEN }}",
50-
"title": "🚀 Astro 部署完成",
51-
"content": "项目已构建并上传至 AWS(分支:${{ github.ref_name }})\n状态:${{ job.status }}",
52-
"template": "txt"
53-
}' \
54+
-d "{
55+
\"token\": \"${{ secrets.PUSHPLUS_TOKEN }}\",
56+
\"title\": \"Astro 部署结果通知\",
57+
\"content\": \"${STATUS_MSG}\",
58+
\"template\": \"txt\"
59+
}" \
5460
https://www.pushplus.plus/send

src/components/posts-loop.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const allPosts = await getCollection("post");
44
55
const { count } = Astro.props;
66
7-
function parseDate(dateStr) {
7+
function parseDate(dateStr: string) {
88
const [month, day, year] = dateStr.split(" ");
99
return new Date(`${month} ${parseInt(day)}, ${year}`);
1010
}
@@ -89,6 +89,6 @@ const postsLoop = sortedPosts.slice(0, count).map((post) => {
8989
</div>
9090
</div>
9191
</div>
92-
)
92+
);
9393
})
9494
}

src/content/post/hello-world.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
layout: ../../layouts/post.astro
3+
title: Hello World
4+
description: Hello World 初次见面!
5+
dateFormatted: Dec 3, 2025
6+
---
7+
8+
# Hello World
9+
10+
初次见面!这是我的第一篇博客文章,欢迎大家阅读!

0 commit comments

Comments
 (0)