diff --git a/_config.yml b/_config.yml index 5dfa21d..5395379 100644 --- a/_config.yml +++ b/_config.yml @@ -107,4 +107,4 @@ deploy: - type: git # 使用 Git 部署 repo: https://github.com/aliceric27/aliceric27.github.io.git # 你的儲存庫 clone branch: gh-pages # 儲存庫分支 - message: "Update blog {{ now('YYYY-MM-DD HH:mm:ss') }}" # Commit 訊息 + message: "Update blog - 2024-11-08 16:18:43" # Commit 訊息 diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 0000000..7c4f875 --- /dev/null +++ b/deploy.sh @@ -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 \ No newline at end of file diff --git a/package.json b/package.json index 34b14f9..26853ea 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "scripts": { "g": "hexo generate", "c": "hexo clean", - "d": "hexo clean && hexo deploy", + "d": "bash deploy.sh", "s": "hexo server" }, "hexo": { diff --git "a/public/2024/11/07/2024-11-07-\344\275\277\347\224\250CloudFlare-Work\346\236\266\350\250\255telegram-bot/index.html" "b/public/2024/11/07/2024-11-07-\344\275\277\347\224\250CloudFlare-Work\346\236\266\350\250\255telegram-bot/index.html" index 8d6bf57..fb9519d 100644 --- "a/public/2024/11/07/2024-11-07-\344\275\277\347\224\250CloudFlare-Work\346\236\266\350\250\255telegram-bot/index.html" +++ "b/public/2024/11/07/2024-11-07-\344\275\277\347\224\250CloudFlare-Work\346\236\266\350\250\255telegram-bot/index.html" @@ -28,7 +28,7 @@ - + diff --git "a/source/_posts/2024-11-07-\344\275\277\347\224\250CloudFlare-Work\346\236\266\350\250\255telegram-bot.md" "b/source/_posts/2024-11-07-\344\275\277\347\224\250CloudFlare-Work\346\236\266\350\250\255telegram-bot.md" index 2d149c9..cb28448 100644 --- "a/source/_posts/2024-11-07-\344\275\277\347\224\250CloudFlare-Work\346\236\266\350\250\255telegram-bot.md" +++ "b/source/_posts/2024-11-07-\344\275\277\347\224\250CloudFlare-Work\346\236\266\350\250\255telegram-bot.md" @@ -7,7 +7,7 @@ categories: - [Tools] --- - + 使用 CloudFlare 免費提供的 Worker 服務作為 Telegram Bot 的 Server @@ -27,7 +27,7 @@ categories: 到 [nodejs.org](https://nodejs.org/en) 下載對應版本安裝 確認是否安裝成功 - + ```bash node -v ```