mirror of
https://github.com/henry4682/fin_buddy_fe.git
synced 2026-07-16 01:30:00 +00:00
All checks were successful
Deploy Frontend to 1Panel / build-and-deploy (push) Successful in 21s
43 lines
1.2 KiB
YAML
43 lines
1.2 KiB
YAML
name: Deploy Frontend to 1Panel
|
||
|
||
on:
|
||
push:
|
||
branches:
|
||
- main
|
||
|
||
jobs:
|
||
build-and-deploy:
|
||
runs-on: ubuntu-22.04
|
||
steps:
|
||
- name: Checkout Code
|
||
uses: actions/checkout@v3
|
||
|
||
- name: Setup Node.js
|
||
uses: actions/setup-node@v3
|
||
with:
|
||
node-version: 22
|
||
|
||
- name: Install Dependencies
|
||
run: npm install
|
||
|
||
# 🎯 關鍵步驟:在 Build 之前,把 Secret 倒出來變成 .env.production
|
||
- name: Generate Environment Variables
|
||
run: |
|
||
cat << 'EOF' > .env.production
|
||
${{ secrets.ENV_FILE }}
|
||
EOF
|
||
|
||
- name: Build Project
|
||
run: npm run build # 🎯 Vite 會在這裡讀取剛剛產生的 .env.production,把網址寫死進去!
|
||
|
||
# 🎯 新增這步:把缺失的 netcat 裝回來
|
||
- name: Deploy to 1Panel via SCP
|
||
uses: appleboy/scp-action@v0.1.7
|
||
with:
|
||
host: fin-buddy.duckdns.org
|
||
username: ubuntu # 你的 Oracle SSH 登入帳號
|
||
key: ${{ secrets.SERVER_SSH_KEY }} # ⚠️ 需要去 Gitea 設定這把私鑰
|
||
source: "dist/*"
|
||
target: "/opt/1panel/apps/openresty/openresty/www/sites/fin-buddy.duckdns.org/index/"
|
||
strip_components: 1
|