Skip to content

Latest commit

 

History

History
71 lines (58 loc) · 1.72 KB

File metadata and controls

71 lines (58 loc) · 1.72 KB

Github CI/CI

部屬至Github page

  • 實作專案 : stockor-dashboard-web

  • 如果是部屬而額外的repo,則必須在路徑前加上repo的名稱

  • 設定調整方式

    • vite.config.js 在加上自己的repo名稱
      // https://vitejs.dev/config/
      export default defineConfig({
      plugins: [vue()],
      build: {
          minify: true,
      },
      resolve: {
          alias: {
          '@': path.resolve(__dirname, './src'),
          },
      },
      base: process.env.NODE_ENV === 'production' ? '/<REPO>/' : './',
      });
    • 針對變數, 透過參數設定自動產生
      • package.json
          {
              "name": "...",
              "version": "0.0.0",
              "scripts": {
                  "dev": "vite",
                  "build": "vite build --base=/<REPO>/",
                  "serve": "vite preview"
              },
          }
  • 部屬

        #!/usr/bin/env sh
    
    # abort on errors
    set -e
    
    # build
    npm run build
    
    # navigate into the build output directory
    cd dist
    
    # if you are deploying to a custom domain
    # echo 'www.example.com' > CNAME
    
    git init
    git checkout -b main
    git add -A
    git commit -m 'deploy'
    
    # if you are deploying to https://<USERNAME>.github.io
    # git push -f git@github.com:<USERNAME>/<USERNAME>.github.io.git main
    
    # if you are deploying to https://<USERNAME>.github.io/<REPO>
    # git push -f git@github.com:<USERNAME>/<REPO>.git main:gh-pages
    
    cd -