Files
linebot_finance/.gitea/workflows/deploy.yaml
henry4682 198f2d2ad9
Some checks failed
Oracle-Deploy / redeploy (push) Failing after 0s
change deploy.yaml
2026-03-23 13:57:18 +08:00

36 lines
1.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Oracle-Deploy
on:
push:
branches:
- main
jobs:
redeploy:
runs-on: self-hosted # 請確認 Gitea Runner 標籤包含 self-hosted
steps:
- name: Checkout Code
# 如果是第一次運行,這步會自動處理目錄
run: |
mkdir -p /home/ubuntu/apps/linebot_finance
cd /home/ubuntu/apps/linebot_finance
- name: Create .env file from Secrets
run: |
# 這裡使用單引號包裹變數,防止特殊字元導致語法出錯
echo '${{ secrets.ENV_FILE }}' > /home/ubuntu/apps/linebot_finance/.env
chmod 600 /home/ubuntu/apps/linebot_finance/.env
echo ".env 檔案已由 Secrets 產生 🚀"
- name: Pull and Restart Service
run: |
cd /home/ubuntu/apps/linebot_finance
# 如果目錄還沒初始化過 Git先進行初始化
if [ ! -d ".git" ]; then
git clone http://127.0.0.1:3000/henry4682/linebot_finance.git .
fi
git fetch origin main
git reset --hard origin/main
# 啟動 Line Bot
docker compose up -d --build --remove-orphans
docker image prune -f