fix App.vue #8
This file contains hidden or 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
| # deploy.yml | |
| # 工作流程的名稱 | |
| name: Deploy Vue App to GitHub Pages | |
| # 觸發條件:當推送到 'main' 分支時觸發 | |
| on: | |
| push: | |
| branches: ['main'] | |
| # 允許您在 Actions 頁籤手動執行此工作流程 | |
| workflow_dispatch: | |
| # 設定權限,讓工作流程可以部署到 GitHub Pages | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # 設定並行策略 | |
| concurrency: | |
| group: 'pages' | |
| cancel-in-progress: true | |
| # 定義工作 | |
| jobs: | |
| deploy: | |
| # 指定執行的環境 | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| # 指定執行的虛擬機類型 | |
| runs-on: ubuntu-latest | |
| # 定義執行的步驟 | |
| steps: | |
| # 步驟 1: 拉取程式碼 | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # 步驟 2: 設定 Node.js 環境 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 # 您可以根據專案需求更改 Node.js 版本 | |
| cache: 'npm' | |
| # 步驟 3: 安裝依賴套件 | |
| - name: Install dependencies | |
| run: npm install | |
| # 步驟 4: 建置專案 | |
| # npm run build 會讀取 vite.config.js 中的 base 設定 | |
| - name: Build | |
| run: npm run build | |
| # 步驟 5: 設定 GitHub Pages | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| # 步驟 6: 上傳建置好的檔案作為 artifact | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| # 指定要上傳的資料夾 (Vite 預設的建置輸出資料夾) | |
| path: './dist' | |
| # 步驟 7: 部署到 GitHub Pages | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |