Skip to content

liyongguo/vue-demo

Repository files navigation

  • 把 dist 目录发布到 gh-pages 分支

    • .gitignore 中不能忽略 dist 目录

    • 把 dist 目录推送到远程的 gh-pages 分支

      git subtree push --prefix dist origin gh-pages
      git push origin --delete gh-pages
  • Git 设置代理

    git config --global http.proxy http://127.0.0.1:1080
    git config --global https.proxy https://127.0.0.1:1080
    
    git config --global --unset http.proxy
    git config --global --unset https.proxy
  • Github Actions

  • 个人设置 - Personal access tokens

    • dd54b30b6e13d084e0695a2ded45a415add0cae5
      
  • 项目 - Settings - Secrets

  • 本地项目,创建 .github/workflows/ci.yml

  • 本地项目,package.json 中增加

    • "homepage": "https://[用户名].github.io/[仓库名称]",
  • 本地项目,创建 vue.config.js

module.exports = {
  outputDir: 'dist',
  publicPath: process.env.NODE_ENV === 'production' ? '/github的仓库名称/' : '/'
}
name: GitHub Actions Build and Deploy Demo
on:
  push:
    branches:
      - master
jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@master
    - name: Build and Deploy
      uses: JamesIves/github-pages-deploy-action@master
      env:
        ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
        BRANCH: gh-pages
        FOLDER: dist
        BUILD_SCRIPT: npm install && npm run build
# https://github.com/marketplace/actions/deploy-to-github-pages

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published