-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d350624
commit 23e85b9
Showing
5 changed files
with
26 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
# 獲取當前日期和時間 | ||
current_date_time=$(date "+%Y-%m-%d %H:%M:%S") | ||
|
||
# 使用 sed 進行就地替換 | ||
# 對於 macOS 的 sed,我們需要給 -i 選項一個空的擴展名參數 ('') | ||
# 對於 GNU sed(Linux),不需要額外的擴展名,所以這裡使用了一個條件判斷來兼容 macOS 和 Linux | ||
if [[ "$OSTYPE" == "darwin"* ]]; then | ||
sed -i '' "s/message: \"[^\"]*\"/message: \"Update blog - $current_date_time\"/" _config.yml | ||
else | ||
sed -i "s/message: \"[^\"]*\"/message: \"Update blog - $current_date_time\"/" _config.yml | ||
fi | ||
|
||
# 清理、生成和部署網站 | ||
hexo clean && hexo g && hexo deploy | ||
|
||
# 添加變更到 Git,提交和推送 | ||
git add . | ||
git commit -m "Update blog - $current_date_time" | ||
git push origin main |
This file contains 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
This file contains 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
This file contains 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